summaryrefslogtreecommitdiff
path: root/ext/spl/examples/norewinditerator.inc
blob: 6564e1d53ef14e1887ec30f1403be8761f193c1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php

/** @file norewinditerator.inc
 * @ingroup Examples
 * @brief class NoRewindIterator
 * @author  Marcus Boerger
 * @date    2003 - 2004
 *
 * SPL - Standard PHP Library
 */

/** @ingroup Examples
 * @brief   An Iterator that doesn't call rewind
 * @author  Marcus Boerger
 * @version 1.0
 *
 */
class NoRewindIterator implements Iterator
{
	protected $it;
	
	function __construct(Iterator $it)
	{
		$this->it = $it;
	}

	function rewind()
	{
		// nothing to do
	}

	function valid()
	{
		return $this->it->valid();
	}

	function current()
	{
		return $this->it->current();
	}

	function key()
	{
		return $this->it->key();
	}

	function next()
	{
		$this->it->next();
	}
}

?>