/** * Returns first element in a given collection * * @param io.IOCollection collection * @return io.IOElement * @throws unittest.AssertionFailedError if no elements are available */ protected function firstElement(IOCollection $collection) { $collection->open(); $first = $collection->next(); $collection->close(); $this->assertNotEquals(NULL, $first, 'No first element in ' . $collection->toString()); return $first; }
/** * Returns first element in a given collection * * @param io.IOCollection collection * @return io.IOElement * @throws unittest.AssertionFailedError if no elements are available */ protected function firstElement(IOCollection $collection) { $collection->open(); $first = $collection->next(); $collection->close(); $this->assertNotEquals(NULL, $first); return $first; }