private function getSortOrder($name = '-datepublish')
    {
        $parts = explode(' ', $name);
        $fieldName = $parts[0];
        $sort = 'ASC';
        if (isset($parts[1])) {
            $sort = $parts[1];
        }

        if ($fieldName[0] === '-') {
            $fieldName = substr($fieldName, 1);
            $sort = 'DESC';
        }

        return [$fieldName, (strtoupper($sort) === 'ASC')];
    }
private function getSortOrder($name = '-datepublish')
    {
        $parts = explode(' ', $name);
        $fieldName = $parts[0];
        $sort = 'ASC';
        if (isset($parts[1])) {
            $sort = $parts[1];
        }

        if ($fieldName[0] === '-') {
            $fieldName = substr($fieldName, 1);
            $sort = 'DESC';
        }

        return [$fieldName, (strtoupper($sort) === 'ASC')];
    }
private function getSortOrder ( $ name = '-datepublish' ) { $ parts = explode ( ' ' , $ name ) ; $ fieldName = $ parts [ 0 ] ; $ sort = 'ASC' ; if ( isset ( $ parts [ 1 ] ) ) { $ sort = $ parts [ 1 ] ; } if ( $ fieldName [ 0 ] === '-' ) { $ fieldName = substr ( $ fieldName , 1 ) ; $ sort = 'DESC' ; } return [ $ fieldName , ( strtoupper ( $ sort ) === 'ASC' ) ] ; }
Get sorting order of name, stripping possible "DESC", "ASC", and also
return the sorting order.

@param string $name

@return array
Get sorting order of name stripping possible DESC ASC and also return the sorting order .