예제 #1
0
 /**
  * {@inheritDoc}
  *
  */
 public function min($callback, $type = SORT_NUMERIC)
 {
     $sorted = new SortIterator($this, $callback, SORT_ASC, $type);
     return $sorted->top();
 }
예제 #2
0
 /**
  * Tests top
  *
  * @return void
  */
 public function testTop()
 {
     $items = new ArrayObject([3, 5, 1, 2, 4]);
     $identity = function ($a) {
         return $a;
     };
     $sorted = new SortIterator($items, $identity);
     $this->assertEquals(5, $sorted->top());
     $sorted = new SortIterator([], $identity);
     $this->assertNull($sorted->top());
 }