public function getSortOrder($name = '-datepublish')
    {
        // If we don't get a string, we can't determine a sortorder.
        if (!is_string($name)) {
            return false;
        }

        $parts = explode(' ', trim($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')];
    }
public function getSortOrder($name = '-datepublish')
    {
        // If we don't get a string, we can't determine a sortorder.
        if (!is_string($name)) {
            return false;
        }

        $parts = explode(' ', trim($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')];
    }
public function getSortOrder ( $ name = '-datepublish' ) { // If we don't get a string, we can't determine a sortorder. if ( ! is_string ( $ name ) ) { return false ; } $ parts = explode ( ' ' , trim ( $ 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" etc., and
also return the sorting order.

@param string $name

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