DesignPatternsPHP/Behavioral/Iterator/BookListReverseIterator.php

25 lines
535 B
PHP
Raw Normal View History

2014-03-24 10:40:08 -03:00
<?php
namespace DesignPatterns\Behavioral\Iterator;
class BookListReverseIterator extends BookListIterator
{
public function __construct(BookList $bookList)
{
$this->bookList = $bookList;
$this->currentBook = $this->bookList->count() - 1;
}
/**
* (PHP 5 &gt;= 5.0.0)<br/>
* Move forward to next element
* @link http://php.net/manual/en/iterator.next.php
* @return void Any returned value is ignored.
*/
2014-03-24 10:40:08 -03:00
public function next()
{
$this->currentBook--;
}
2014-04-16 17:59:03 -03:00
}