protected function yearSort($a, $b)
    {
        $aDates = $this->extractNewestDates($a);
        $bDates = $this->extractNewestDates($b);

        if (count($aDates) > 0 && count($bDates) > 0) {
            return $bDates[0] - $aDates[0];
        } elseif (count($aDates) > 0 && count($bDates) === 0) {
            return -1;
        } elseif (count($aDates) === 0 && count($bDates) > 0) {
            return 1;
        } else {
            return 0;
        }
    }
protected function yearSort($a, $b)
    {
        $aDates = $this->extractNewestDates($a);
        $bDates = $this->extractNewestDates($b);

        if (count($aDates) > 0 && count($bDates) > 0) {
            return $bDates[0] - $aDates[0];
        } elseif (count($aDates) > 0 && count($bDates) === 0) {
            return -1;
        } elseif (count($aDates) === 0 && count($bDates) > 0) {
            return 1;
        } else {
            return 0;
        }
    }
protected function yearSort ( $ a , $ b ) { $ aDates = $ this -> extractNewestDates ( $ a ) ; $ bDates = $ this -> extractNewestDates ( $ b ) ; if ( count ( $ aDates ) > 0 && count ( $ bDates ) > 0 ) { return $ bDates [ 0 ] - $ aDates [ 0 ] ; } elseif ( count ( $ aDates ) > 0 && count ( $ bDates ) === 0 ) { return - 1 ; } elseif ( count ( $ aDates ) === 0 && count ( $ bDates ) > 0 ) { return 1 ; } else { return 0 ; } }
Auxiliary sort function for sorting records and locations based
on their 'date' field with the newest item being first and undefined
dates last.

@param array $a location or full pazpar2 record
@param array $b location or full pazpar2 record
@return int
Auxiliary sort function for sorting records and locations based on their date field with the newest item being first and undefined dates last .