src/Klarna.php
public function sortPClasses(&$array)
    {
        if (!is_array($array)) {
            //Input is not an array!
            $array = array();
            return;
        }
        //Sort pclasses array after natural sort (natcmp)
        if (!function_exists('pcCmp')) {
            /**
             * Comparison function
             *
             * @param KlarnaPClass $a object 1
             * @param KlarnaPClass $b object 2
             *
             * @return int
             */
            function pcCmp($a, $b)
            {
                if ($a->getDescription() == null
                    && $b->getDescription() == null
                ) {
                    return 0;
                } else if ($a->getDescription() == null) {
                    return 1;
                } else if ($b->getDescription() == null) {
                    return -1;
                } else if ($b->getType() === 2 && $a->getType() !== 2) {
                    return 1;
                } else if ($b->getType() !== 2 && $a->getType() === 2) {
                    return -1;
                }

                return strnatcmp($a->getDescription(), $b->getDescription())*-1;
            }
        }
        usort($array, "pcCmp");
    }
public function sortPClasses(&$array)
    {
        if (!is_array($array)) {
            //Input is not an array!
            $array = array();
            return;
        }
        //Sort pclasses array after natural sort (natcmp)
        if (!function_exists('pcCmp')) {
            /**
             * Comparison function
             *
             * @param KlarnaPClass $a object 1
             * @param KlarnaPClass $b object 2
             *
             * @return int
             */
            function pcCmp($a, $b)
            {
                if ($a->getDescription() == null
                    && $b->getDescription() == null
                ) {
                    return 0;
                } else if ($a->getDescription() == null) {
                    return 1;
                } else if ($b->getDescription() == null) {
                    return -1;
                } else if ($b->getType() === 2 && $a->getType() !== 2) {
                    return 1;
                } else if ($b->getType() !== 2 && $a->getType() === 2) {
                    return -1;
                }

                return strnatcmp($a->getDescription(), $b->getDescription())*-1;
            }
        }
        usort($array, "pcCmp");
    }
public function sortPClasses ( & $ array ) { if ( ! is_array ( $ array ) ) { //Input is not an array! $ array = array ( ) ; return ; } //Sort pclasses array after natural sort (natcmp) if ( ! function_exists ( 'pcCmp' ) ) { /**
             * Comparison function
             *
             * @param KlarnaPClass $a object 1
             * @param KlarnaPClass $b object 2
             *
             * @return int
             */ function pcCmp ( $ a , $ b ) { if ( $ a -> getDescription ( ) == null && $ b -> getDescription ( ) == null ) { return 0 ; } else if ( $ a -> getDescription ( ) == null ) { return 1 ; } else if ( $ b -> getDescription ( ) == null ) { return - 1 ; } else if ( $ b -> getType ( ) === 2 && $ a -> getType ( ) !== 2 ) { return 1 ; } else if ( $ b -> getType ( ) !== 2 && $ a -> getType ( ) === 2 ) { return - 1 ; } return strnatcmp ( $ a -> getDescription ( ) , $ b -> getDescription ( ) ) * - 1 ; } } usort ( $ array , "pcCmp" ) ; }
Sorts the specified array of KlarnaPClasses.

@param array &$array An array of {@link KlarnaPClass PClasses}.

@return void
Sorts the specified array of KlarnaPClasses .