protected static function sortPluralizedCompare($a, $b)
    {
        if ($a == $b) {
            return 0;
        }

        $rangeA = explode(':', $a);
        $rangeB = explode(':', $b);

        // Both range starts provided.
        if (isset($rangeA[0]) && isset($rangeB[0])) {
            return strcmp($rangeA[0], $rangeB[0]);
        }

        // Only second range has a starting point.
        if (!isset($rangeA[0]) && isset($rangeB[0])) {
            return -1;
        }

        // Only first range has a starting point.
        if (isset($rangeA[0]) && !isset($rangeB[0])) {
            return 1;
        }

        // Both are an open start range.
        if (isset($rangeA[1]) && isset($rangeB[1])) {
            return strcmp($rangeA[1], $rangeB[1]);
        }

        // Only second range is open => First is first.
        if (!isset($rangeA[1]) && isset($rangeB[1])) {
            return 1;
        }

        // Only first range is open => Second is first.
        if (isset($rangeA[1]) && !isset($rangeB[1])) {
            return -1;
        }

        // Just here to make the IDEs happy - is already handled above as early exit point.
        return 0;
    }
protected static function sortPluralizedCompare($a, $b)
    {
        if ($a == $b) {
            return 0;
        }

        $rangeA = explode(':', $a);
        $rangeB = explode(':', $b);

        // Both range starts provided.
        if (isset($rangeA[0]) && isset($rangeB[0])) {
            return strcmp($rangeA[0], $rangeB[0]);
        }

        // Only second range has a starting point.
        if (!isset($rangeA[0]) && isset($rangeB[0])) {
            return -1;
        }

        // Only first range has a starting point.
        if (isset($rangeA[0]) && !isset($rangeB[0])) {
            return 1;
        }

        // Both are an open start range.
        if (isset($rangeA[1]) && isset($rangeB[1])) {
            return strcmp($rangeA[1], $rangeB[1]);
        }

        // Only second range is open => First is first.
        if (!isset($rangeA[1]) && isset($rangeB[1])) {
            return 1;
        }

        // Only first range is open => Second is first.
        if (isset($rangeA[1]) && !isset($rangeB[1])) {
            return -1;
        }

        // Just here to make the IDEs happy - is already handled above as early exit point.
        return 0;
    }
protected static function sortPluralizedCompare ( $ a , $ b ) { if ( $ a == $ b ) { return 0 ; } $ rangeA = explode ( ':' , $ a ) ; $ rangeB = explode ( ':' , $ b ) ; // Both range starts provided. if ( isset ( $ rangeA [ 0 ] ) && isset ( $ rangeB [ 0 ] ) ) { return strcmp ( $ rangeA [ 0 ] , $ rangeB [ 0 ] ) ; } // Only second range has a starting point. if ( ! isset ( $ rangeA [ 0 ] ) && isset ( $ rangeB [ 0 ] ) ) { return - 1 ; } // Only first range has a starting point. if ( isset ( $ rangeA [ 0 ] ) && ! isset ( $ rangeB [ 0 ] ) ) { return 1 ; } // Both are an open start range. if ( isset ( $ rangeA [ 1 ] ) && isset ( $ rangeB [ 1 ] ) ) { return strcmp ( $ rangeA [ 1 ] , $ rangeB [ 1 ] ) ; } // Only second range is open => First is first. if ( ! isset ( $ rangeA [ 1 ] ) && isset ( $ rangeB [ 1 ] ) ) { return 1 ; } // Only first range is open => Second is first. if ( isset ( $ rangeA [ 1 ] ) && ! isset ( $ rangeB [ 1 ] ) ) { return - 1 ; } // Just here to make the IDEs happy - is already handled above as early exit point. return 0 ; }
Compare function for the pluralization array to be used as sorting callback.

See documentation of usort in the php manual for details.

@param string $a The first value.
@param string $b The second value.

@return int

@SuppressWarnings(PHPMD.ShortVariable)
@SuppressWarnings(PHPMD.CyclomaticComplexity)
@SuppressWarnings(PHPMD.NPathComplexity)
Compare function for the pluralization array to be used as sorting callback .