forked from MARCspec/php-marc-spec
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSpecIterator.php
More file actions
executable file
·55 lines (44 loc) · 993 Bytes
/
SpecIterator.php
File metadata and controls
executable file
·55 lines (44 loc) · 993 Bytes
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
54
55
<?php
/**
* MARCspec is the specification of a reference, encoded as string, to a set of data
* from within a MARC record.
*
* @author Carsten Klee <mailme.klee@yahoo.de>
* @copyright For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CK\MARCspec;
class SpecIterator implements \Iterator
{
private $var = [];
public function __construct($array)
{
if (is_array($array)) {
$this->var = $array;
}
}
public function rewind()
{
reset($this->var);
}
public function current()
{
$var = current($this->var);
return $var;
}
public function key()
{
$var = key($this->var);
return $var;
}
public function next()
{
$var = next($this->var);
return $var;
}
public function valid()
{
$var = $this->current() !== false;
return $var;
}
}