protected function sortLocales()
    {
        usort($this->locales, function ($a, $b) {
            if ($a->weight === $b->weight) {
                return 0;
            }

            return ($a->weight > $b->weight) ? -1 : 1;
        });
    }
protected function sortLocales()
    {
        usort($this->locales, function ($a, $b) {
            if ($a->weight === $b->weight) {
                return 0;
            }

            return ($a->weight > $b->weight) ? -1 : 1;
        });
    }
protected function sortLocales ( ) { usort ( $ this -> locales , function ( $ a , $ b ) { if ( $ a -> weight === $ b -> weight ) { return 0 ; } return ( $ a -> weight > $ b -> weight ) ? - 1 : 1 ; } ) ; }
Sort the array of locales in descending order of preference.

@return void
Sort the array of locales in descending order of preference .