public function reverse() {
		if(!$this->orderBy)
			throw new \Exception('Cannot reverse a query without order by.');

		preg_match_all('/([^,])*([(].*?[)])([^,])*|([^,])+/', $this->orderBy, $e);
		$e = $e[0];
		foreach($e as $k=>$v) {
			$v = preg_replace_callback('/(DESC|ASC)[\s]*/', function($r) {
				$r = $r[0];
				if(strpos($r, 'DESC') !== false)
					return str_replace('DESC', 'ASC', $r);
				else
					return str_replace('ASC', 'DESC', $r);
			}, $v, -1, $c);
			if($c === 0)
				$v = $v.' DESC';
			$e[$k] = $v;
		}
		$orderBy = implode(', ', $e);

		$this->orderBy($orderBy);
		return $this;
	}
public function reverse() {
		if(!$this->orderBy)
			throw new \Exception('Cannot reverse a query without order by.');

		preg_match_all('/([^,])*([(].*?[)])([^,])*|([^,])+/', $this->orderBy, $e);
		$e = $e[0];
		foreach($e as $k=>$v) {
			$v = preg_replace_callback('/(DESC|ASC)[\s]*/', function($r) {
				$r = $r[0];
				if(strpos($r, 'DESC') !== false)
					return str_replace('DESC', 'ASC', $r);
				else
					return str_replace('ASC', 'DESC', $r);
			}, $v, -1, $c);
			if($c === 0)
				$v = $v.' DESC';
			$e[$k] = $v;
		}
		$orderBy = implode(', ', $e);

		$this->orderBy($orderBy);
		return $this;
	}
public function reverse ( ) { if ( ! $ this -> orderBy ) throw new \ Exception ( 'Cannot reverse a query without order by.' ) ; preg_match_all ( '/([^,])*([(].*?[)])([^,])*|([^,])+/' , $ this -> orderBy , $ e ) ; $ e = $ e [ 0 ] ; foreach ( $ e as $ k => $ v ) { $ v = preg_replace_callback ( '/(DESC|ASC)[\s]*/' , function ( $ r ) { $ r = $ r [ 0 ] ; if ( strpos ( $ r , 'DESC' ) !== false ) return str_replace ( 'DESC' , 'ASC' , $ r ) ; else return str_replace ( 'ASC' , 'DESC' , $ r ) ; } , $ v , - 1 , $ c ) ; if ( $ c === 0 ) $ v = $ v . ' DESC' ; $ e [ $ k ] = $ v ; } $ orderBy = implode ( ', ' , $ e ) ; $ this -> orderBy ( $ orderBy ) ; return $ this ; }
Reverse the query order.
@return static
Reverse the query order .