public function prepareOrder($order = null, $sort = null)
    {
        if ($order == null or $sort == null) {
            $this->setOrderBy = '';

            return $this;
        }

        if (!in_array($sort, ['ASC', 'DESC'])) {
            $sort = 'DESC';
        }

        $this->setOrderBy = ' ORDER BY ' . $order . ' ' . $sort;

        return $this;
    }
public function prepareOrder($order = null, $sort = null)
    {
        if ($order == null or $sort == null) {
            $this->setOrderBy = '';

            return $this;
        }

        if (!in_array($sort, ['ASC', 'DESC'])) {
            $sort = 'DESC';
        }

        $this->setOrderBy = ' ORDER BY ' . $order . ' ' . $sort;

        return $this;
    }
public function prepareOrder ( $ order = null , $ sort = null ) { if ( $ order == null or $ sort == null ) { $ this -> setOrderBy = '' ; return $ this ; } if ( ! in_array ( $ sort , [ 'ASC' , 'DESC' ] ) ) { $ sort = 'DESC' ; } $ this -> setOrderBy = ' ORDER BY ' . $ order . ' ' . $ sort ; return $ this ; }
prepareOrder function.

@param string $order
@param string $sort

@return Database
prepareOrder function .