for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Ipl\IteratorPipeline\Traits;
use Ipl as i;
/**
* Methods that change the order of the elements.
*/
trait SortingTrait
{
* Define the next step via a callback that returns an array or Traversable object.
*
* @param callable $callback
* @param mixed ...$args
* @return static
abstract public function then(callable $callback, ...$args);
* Sort all elements of an iterator.
* @param callable|int $compare SORT_* flags as binary set or callback comparator function
* @param bool $preserveKeys
public function sort($compare, bool $preserveKeys = true)
return $this->then(i\iterable_sort, $compare, $preserveKeys);
}
* Sort all elements of an iterator based on the key.
public function sortKeys($compare)
return $this->then(i\iterable_sort_keys, $compare);
* Reverse order of elements of an iterable.
public function reverse()
return $this->then(i\iterable_reverse);