/** * Checks if current position is valid * * @return boolean The return value will be casted to boolean and then evaluated. * Returns true on success or false on failure. */ public function valid() { return !is_null($this->bookShelf->getBookAt($this->index)); }
/** * @return Book */ public function next() { $book = $this->bookShelf->getBookAt($this->index); $this->index++; return $book; }