src/GenericFilter.php
public function orderBy( $field, $dir = Filter::SORT_ASC ) {
	
		$field = trim($field);

		if( empty($field) )
			throw new \InvalidArgumentException('No field specified');

		$modifier = substr($field, 0, 1);

		if( in_array($modifier, ['+', '-']) ) {
			$dir = ($modifier == '+');
			$field = substr($field, 1);
		}

		$this->orderby[$field] = $dir;

		return $this;

	}
public function orderBy( $field, $dir = Filter::SORT_ASC ) {
	
		$field = trim($field);

		if( empty($field) )
			throw new \InvalidArgumentException('No field specified');

		$modifier = substr($field, 0, 1);

		if( in_array($modifier, ['+', '-']) ) {
			$dir = ($modifier == '+');
			$field = substr($field, 1);
		}

		$this->orderby[$field] = $dir;

		return $this;

	}
public function orderBy ( $ field , $ dir = Filter :: SORT_ASC ) { $ field = trim ( $ field ) ; if ( empty ( $ field ) ) throw new \ InvalidArgumentException ( 'No field specified' ) ; $ modifier = substr ( $ field , 0 , 1 ) ; if ( in_array ( $ modifier , [ '+' , '-' ] ) ) { $ dir = ( $ modifier == '+' ) ; $ field = substr ( $ field , 1 ) ; } $ this -> orderby [ $ field ] = $ dir ; return $ this ; }
Specify a field to order the results by.
Multiple levels of ordering can be specified by calling this method multiple times.
@param  string   $field   name of the field
@param  boolean  $dir     true to sort ascending, false to sort descending
@return self
Specify a field to order the results by . Multiple levels of ordering can be specified by calling this method multiple times .