xref: /PHP-5.4/ext/spl/internal/emptyiterator.inc (revision 7a24ee13)
1<?php
2
3/** @file emptyiterator.inc
4 * @ingroup SPL
5 * @brief class EmptyIterator
6 * @author  Marcus Boerger
7 * @date    2003 - 2009
8 *
9 * SPL - Standard PHP Library
10 */
11
12/** @ingroup SPL
13 * @brief   An empty Iterator
14 * @author  Marcus Boerger
15 * @version 1.0
16 * @since PHP 5.1
17 */
18class EmptyIterator implements Iterator
19{
20	/** No operation.
21	 * @return void
22	 */
23	function rewind()
24	{
25		// nothing to do
26	}
27
28	/** @return \c false
29	 */
30	function valid()
31	{
32		return false;
33	}
34
35	/** This function must not be called. It throws an exception upon access.
36	 * @throw Exception
37	 * @return void
38	 */
39	function current()
40	{
41		throw new Exception('Accessing the value of an EmptyIterator');
42	}
43
44	/** This function must not be called. It throws an exception upon access.
45	 * @throw Exception
46	 * @return void
47	 */
48	function key()
49	{
50		throw new Exception('Accessing the key of an EmptyIterator');
51	}
52
53	/** No operation.
54	 * @return void
55	 */
56	function next()
57	{
58		// nothing to do
59	}
60}
61
62?>