/var/www/vhosts/ihelp.ro/_OLD/vendor/cakephp/cakephp/src/Collection/Iterator
NameSizeModeActions
BufferedIterator.php47700644editdlrm
ExtractIterator.php29520644editdlrm
FilterIterator.php27390644editdlrm
InsertIterator.php38110644editdlrm
MapReduce.php57540644editdlrm
NestIterator.php22550644editdlrm
NoChildrenIterator.php13680644editdlrm
ReplaceIterator.php28780644editdlrm
SortIterator.php31200644editdlrm
StoppableIterator.php33170644editdlrm
TreeIterator.php34880644editdlrm
TreePrinter.php35180644editdlrm
UnfoldIterator.php26300644editdlrm
ZipIterator.php35840644editdlrm
Edit: /var/www/vhosts/ihelp.ro/_OLD/vendor/cakephp/cakephp/src/Collection/Iterator/SortIterator.php (3120B)
age; * }); * * // output all user name order by their age in descending order * foreach ($sorted as $user) { * echo $user->name; * } * ``` * * This iterator does not preserve the keys passed in the original elements. */ class SortIterator extends Collection { /** * Wraps this iterator around the passed items so when iterated they are returned * in order. * * The callback will receive as first argument each of the elements in $items, * the value returned in the callback will be used as the value for sorting such * element. Please note that the callback function could be called more than once * per element. * * @param iterable $items The values to sort * @param callable|string $callback A function used to return the actual value to * be compared. It can also be a string representing the path to use to fetch a * column or property in each element * @param int $dir either SORT_DESC or SORT_ASC * @param int $type the type of comparison to perform, either SORT_STRING * SORT_NUMERIC or SORT_NATURAL */ public function __construct(iterable $items, $callback, int $dir = \SORT_DESC, int $type = \SORT_NUMERIC) { if (!is_array($items)) { $items = iterator_to_array((new Collection($items))->unwrap(), false); } $callback = $this->_propertyExtractor($callback); $results = []; foreach ($items as $key => $val) { $val = $callback($val); if ($val instanceof DateTimeInterface && $type === \SORT_NUMERIC) { $val = $val->format('U'); } $results[$key] = $val; } $dir === SORT_DESC ? arsort($results, $type) : asort($results, $type); foreach (array_keys($results) as $key) { $results[$key] = $items[$key]; } parent::__construct($results); } /** * {@inheritDoc} * * @return \Traversable */ public function unwrap(): Traversable { return $this->getInnerIterator(); } }