blob: 4c6086b6a48b4a25b9666f7f89081cb414c949ec (
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
|
<?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);
}
}
|