protected function parseSortDefinition($definition) {
		$definition = trim($definition);
		$spacePos   = strrpos($definition, ' ');
		
		if ($spacePos === false) {
			return [$definition, SORT_ASC];
		}
		
		$property  = substr($definition, 0, $spacePos);
		$direction = substr($definition, $spacePos);
		$direction = strtolower(ltrim($direction));

		if ($direction === self::SORT_ASC) {
			return [$property, SORT_ASC];
		}
		
		if ($direction === self::SORT_DESC) {
			return [$property, SORT_DESC];
		}
		
		throw new Exception('Unknown sort direction: "' . $direction . '"');
	}
protected function parseSortDefinition($definition) {
		$definition = trim($definition);
		$spacePos   = strrpos($definition, ' ');
		
		if ($spacePos === false) {
			return [$definition, SORT_ASC];
		}
		
		$property  = substr($definition, 0, $spacePos);
		$direction = substr($definition, $spacePos);
		$direction = strtolower(ltrim($direction));

		if ($direction === self::SORT_ASC) {
			return [$property, SORT_ASC];
		}
		
		if ($direction === self::SORT_DESC) {
			return [$property, SORT_DESC];
		}
		
		throw new Exception('Unknown sort direction: "' . $direction . '"');
	}
protected function parseSortDefinition ( $ definition ) { $ definition = trim ( $ definition ) ; $ spacePos = strrpos ( $ definition , ' ' ) ; if ( $ spacePos === false ) { return [ $ definition , SORT_ASC ] ; } $ property = substr ( $ definition , 0 , $ spacePos ) ; $ direction = substr ( $ definition , $ spacePos ) ; $ direction = strtolower ( ltrim ( $ direction ) ) ; if ( $ direction === self :: SORT_ASC ) { return [ $ property , SORT_ASC ] ; } if ( $ direction === self :: SORT_DESC ) { return [ $ property , SORT_DESC ] ; } throw new Exception ( 'Unknown sort direction: "' . $ direction . '"' ) ; }
Parse the sort definition

@param  string $definition
@return array  [property, direction]
@throws Exception
Parse the sort definition