public function sortBySource($sortingType)
    {
        $returnValue = $this->getTranslationUnits();
        switch ($sortingType) {
            case self::SORT_ASC:
                $cmpFunction = function ($a, $b) {
                    return strcmp($a->getSource(), $b->getSource());
                };
                break;
            case self::SORT_ASC_I:
                $cmpFunction = function ($a, $b) {
                    return strcmp(mb_strtolower($a->getSource(), "UTF-8"), mb_strtolower($b->getSource(), "UTF-8"));
                };
                break;
            case self::SORT_DESC:
                $cmpFunction = function ($a, $b) {
                    return - 1 * strcmp($a->getSource(), $b->getSource());
                };
                break;
            case self::SORT_DESC_I:
                $cmpFunction = function ($a, $b) {
                    return - 1 * strcmp(mb_strtolower($a->getSource(), "UTF-8"), mb_strtolower($b->getSource(), "UTF-8"));
                };
                break;
            default:
                throw new common_Exception('Unknown sortingType ' . $sortingType);
        }
        usort($returnValue, $cmpFunction);
        return $returnValue;
    }
public function sortBySource($sortingType)
    {
        $returnValue = $this->getTranslationUnits();
        switch ($sortingType) {
            case self::SORT_ASC:
                $cmpFunction = function ($a, $b) {
                    return strcmp($a->getSource(), $b->getSource());
                };
                break;
            case self::SORT_ASC_I:
                $cmpFunction = function ($a, $b) {
                    return strcmp(mb_strtolower($a->getSource(), "UTF-8"), mb_strtolower($b->getSource(), "UTF-8"));
                };
                break;
            case self::SORT_DESC:
                $cmpFunction = function ($a, $b) {
                    return - 1 * strcmp($a->getSource(), $b->getSource());
                };
                break;
            case self::SORT_DESC_I:
                $cmpFunction = function ($a, $b) {
                    return - 1 * strcmp(mb_strtolower($a->getSource(), "UTF-8"), mb_strtolower($b->getSource(), "UTF-8"));
                };
                break;
            default:
                throw new common_Exception('Unknown sortingType ' . $sortingType);
        }
        usort($returnValue, $cmpFunction);
        return $returnValue;
    }
public function sortBySource ( $ sortingType ) { $ returnValue = $ this -> getTranslationUnits ( ) ; switch ( $ sortingType ) { case self :: SORT_ASC : $ cmpFunction = function ( $ a , $ b ) { return strcmp ( $ a -> getSource ( ) , $ b -> getSource ( ) ) ; } ; break ; case self :: SORT_ASC_I : $ cmpFunction = function ( $ a , $ b ) { return strcmp ( mb_strtolower ( $ a -> getSource ( ) , "UTF-8" ) , mb_strtolower ( $ b -> getSource ( ) , "UTF-8" ) ) ; } ; break ; case self :: SORT_DESC : $ cmpFunction = function ( $ a , $ b ) { return - 1 * strcmp ( $ a -> getSource ( ) , $ b -> getSource ( ) ) ; } ; break ; case self :: SORT_DESC_I : $ cmpFunction = function ( $ a , $ b ) { return - 1 * strcmp ( mb_strtolower ( $ a -> getSource ( ) , "UTF-8" ) , mb_strtolower ( $ b -> getSource ( ) , "UTF-8" ) ) ; } ; break ; default : throw new common_Exception ( 'Unknown sortingType ' . $ sortingType ) ; } usort ( $ returnValue , $ cmpFunction ) ; return $ returnValue ; }
Sorts and returns the TranslationUnits by Source with a specified sorting

@access public
@author Jerome Bogaerts, <jerome.bogaerts@tudor.lu>
@param  int sortingType
@return array
Sorts and returns the TranslationUnits by Source with a specified sorting