/** * {@inheritDoc} * */ public function min($callback, $type = SORT_NUMERIC) { $sorted = new SortIterator($this, $callback, SORT_ASC, $type); return $sorted->top(); }
/** * 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()); }