/** * @param array|Phinq|Iterator|IteratorAggregate $collection The initial collection to query on */ protected function __construct($collection, array $queries = array()) { $this->collection = Util::convertToNumericallyIndexedArray($collection); $this->evaluatedCollection = $this->collection; if (!empty($queries)) { foreach ($queries as $query) { $this->addToQueue($query); } } }
/** * @link http://www.php.net/manual/en/function.array-multisort.php#90917 * @return Closure */ public function getSortingCallback() { //need to perform a multisort using callbacks... which PHP can't do natively $previousCallback = $this->previousQuery->getSortingCallback(); $currentCallback = Util::getDefaultSortCallback($this->getLambdaExpression(), $this->isDescending()); return function ($a, $b) use($previousCallback, $currentCallback) { $previousValue = $previousCallback($a, $b); if ($previousValue !== 0) { return $previousValue; } return $currentCallback($a, $b); }; }
public function getSortingCallback() { $lambda = $this->getLambdaExpression(); return Util::getDefaultSortCallback($lambda, $this->isDescending()); }