CommentModel::_WhereFromOrderBy PHP Method

_WhereFromOrderBy() protected method

Builds Where statements for GetOffset method.
See also: CommentModel::GetOffset()
Since: 2.0.0
protected _WhereFromOrderBy ( array $Part, object $Comment, string $Op = '' ) : array
$Part array Value from $this->_OrderBy.
$Comment object
$Op string Comparison operator.
return array Expression and value.
    protected function _WhereFromOrderBy($Part, $Comment, $Op = '')
    {
        if (!$Op || $Op == '=') {
            $Op = ($Part[1] == 'desc' ? '>' : '<') . $Op;
        } elseif ($Op == '==') {
            $Op = '=';
        }
        $Expr = $Part[0] . ' ' . $Op;
        if (preg_match('/c\\.(\\w*\\b)/', $Part[0], $Matches)) {
            $Field = $Matches[1];
        } else {
            $Field = $Part[0];
        }
        $Value = val($Field, $Comment);
        if (!$Value) {
            $Value = 0;
        }
        return array($Expr, $Value);
    }