Пример #1
0
 /**
  * @chainable
  * @category  Arrays
  * @param     array     $xs
  * @param     callable  $compare
  * @return    Iterator
  */
 public static function sort($xs, $compare = null)
 {
     return new Iterator\DeferIterator(function () use($xs, $compare) {
         return new \ArrayIterator(ArrayImpl::sort($xs, $compare));
     });
 }
Пример #2
0
 /**
  * @chainable
  * @category  Arrays
  * @param     array     $xs
  * @param     callable  $compare
  * @return    Generator
  */
 public static function sort($xs, $compare = null)
 {
     foreach (ArrayImpl::sort($xs, $compare) as $x) {
         (yield $x);
     }
 }