blob: 70ff07fa9f931e10a414485bcfd88b64a73fe97f (
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
|
<?php
// TODO: not working
class IsisSubfieldIterator implements Iterator
{
private $position = 0;
private $class;
private $field;
private $subfields;
private $keys;
public function __construct($class, $field)
{
$this->class = $class;
$this->field = $field;
$this->subfields = $class->getSubfields($field);
$this->keys = array_values($this->subfields);
$this->total = count($this->class->result[$field['name']);
print_r($field);
}
function subfield()
{
return $this->subfields[$this->key()];
}
function rewind()
{
$this->position = 0;
}
function current()
{
$value = $this->class->getSubfield($this->field, $this->subfield());
return $this->class->explodeValue($value);
}
function key()
{
return $this->keys[$this->position];
}
function next()
{
++$this->position;
}
function valid()
{
return isset($this->keys[$this->position]) && ($this->current() != null);
}
}
|