コード例 #1
0
ファイル: iterator.php プロジェクト: sKudryashov/oop_patterns
    echo "getting next book with iterator : " . tagins("br");
    echo $book->getAuthorAndTitle();
    echo tagins("br") . tagins("br");
}
$book = $booksIterator->getCurrentBook();
echo "getting current book with iterator : " . tagins("br");
echo $book->getAuthorAndTitle();
echo tagins("br") . tagins("br");
echo tagins("br");
echo "Testing the Reverse Iterator" . tagins("br");
$booksReverseIterator = new BookListReverseIterator($books);
while ($booksReverseIterator->hasNextBook()) {
    $book = $booksReverseIterator->getNextBook();
    echo "getting next book with reverse iterator : " . tagins("br");
    echo $book->getAuthorAndTitle();
    echo tagins("br") . tagins("br");
}
$book = $booksReverseIterator->getCurrentBook();
echo "getting current book with reverse iterator : " . tagins("br");
echo $book->getAuthorAndTitle();
echo tagins("br") . tagins("br");
echo tagins("br");
echo "END TESTING ITERATOR PATTERN";
echo tagins("br");
echo tagins("/body");
echo tagins("/html");
//doing this so code can be displayed without breaks
function tagins($stuffing)
{
    return "<" . $stuffing . ">";
}