php-src/ext/spl/examples/emptyiterator.inc

62 lines
977 B
PHP
Raw Normal View History

2004-04-27 18:15:00 +00:00
<?php
/** @file emptyiterator.inc
* @ingroup Examples
* @brief class EmptyIterator
* @author Marcus Boerger
* @date 2003 - 2004
*
* SPL - Standard PHP Library
*/
/** @ingroup Examples
2004-04-27 18:15:00 +00:00
* @brief An empty Iterator
* @author Marcus Boerger
* @version 1.0
*
*/
class EmptyIterator implements Iterator
{
/** No operation.
* @return void
*/
2004-04-27 18:15:00 +00:00
function rewind()
{
// nothing to do
}
/** @return \c false
*/
2004-04-27 18:15:00 +00:00
function valid()
{
return false;
}
/** This function must not be called. It throws an exception upon access.
* @throw Exception
* @return void
*/
2004-04-27 18:15:00 +00:00
function current()
{
throw new Exception('Accessing the value of an EmptyIterator');
}
/** This function must not be called. It throws an exception upon access.
* @throw Exception
* @return void
*/
2004-04-27 18:15:00 +00:00
function key()
{
throw new Exception('Accessing the key of an EmptyIterator');
}
/** No operation.
* @return void
*/
2004-04-27 18:15:00 +00:00
function next()
{
// nothing to do
}
}
?>