public function qualityFactorComparator($mediaType1, $mediaType2)
    {
        $diff = $mediaType2['q'] - $mediaType1['q'];

        // doesn't cope too well with values 1 > v > -1, so make sure we return simple integers
        if ($diff > 0) {
            $diff = 1;
        } elseif ($diff < 0) {
            $diff = -1;
        }

        return $diff;
    }
public function qualityFactorComparator($mediaType1, $mediaType2)
    {
        $diff = $mediaType2['q'] - $mediaType1['q'];

        // doesn't cope too well with values 1 > v > -1, so make sure we return simple integers
        if ($diff > 0) {
            $diff = 1;
        } elseif ($diff < 0) {
            $diff = -1;
        }

        return $diff;
    }
public function qualityFactorComparator ( $ mediaType1 , $ mediaType2 ) { $ diff = $ mediaType2 [ 'q' ] - $ mediaType1 [ 'q' ] ; // doesn't cope too well with values 1 > v > -1, so make sure we return simple integers if ( $ diff > 0 ) { $ diff = 1 ; } elseif ( $ diff < 0 ) { $ diff = - 1 ; } return $ diff ; }
Comparator function for sorting a list of arrays by their 'q' factor.

@param  array   $mediaType1
@param  array   $mediaType2
@return integer
Comparator function for sorting a list of arrays by their q factor .