1 | <?php |
||
11 | class Result implements \Iterator, ResultInterface |
||
12 | { |
||
13 | |||
14 | /** |
||
15 | * @var string Result string |
||
16 | */ |
||
17 | protected $name; |
||
18 | /** |
||
19 | * @var string Result string |
||
20 | */ |
||
21 | protected $value; |
||
22 | /** |
||
23 | * @var integer Start position |
||
24 | */ |
||
25 | protected $start; |
||
26 | /** |
||
27 | * @var integer Final position |
||
28 | */ |
||
29 | protected $end; |
||
30 | /** |
||
31 | * @var Result[] |
||
32 | */ |
||
33 | protected $children; |
||
34 | /** |
||
35 | * @var integer |
||
36 | */ |
||
37 | private $key; |
||
38 | |||
39 | /** |
||
40 | * @param string $name |
||
41 | */ |
||
42 | 27 | public function __construct($name) |
|
46 | |||
47 | /** |
||
48 | * @return string |
||
49 | */ |
||
50 | 3 | public function getValue() |
|
54 | |||
55 | /** |
||
56 | * @param string $value |
||
57 | * @param integer $start |
||
58 | */ |
||
59 | 9 | public function setValue($value, $start) |
|
65 | |||
66 | /** |
||
67 | * @return string |
||
68 | */ |
||
69 | 8 | public function getName() |
|
70 | { |
||
71 | 8 | return $this->name; |
|
72 | } |
||
73 | |||
74 | /** |
||
75 | * Added child result |
||
76 | * |
||
77 | * @param Result $child |
||
78 | */ |
||
79 | 17 | public function addChild(Result $child) |
|
83 | |||
84 | /** |
||
85 | * @return Result |
||
86 | */ |
||
87 | 4 | public function current() |
|
91 | |||
92 | /** |
||
93 | * {@inheritdoc} |
||
94 | */ |
||
95 | 4 | public function next() |
|
99 | |||
100 | /** |
||
101 | * {@inheritdoc} |
||
102 | */ |
||
103 | 4 | public function key() |
|
107 | |||
108 | /** |
||
109 | * {@inheritdoc} |
||
110 | */ |
||
111 | 4 | public function valid() |
|
115 | |||
116 | /** |
||
117 | * {@inheritdoc} |
||
118 | */ |
||
119 | 4 | public function rewind() |
|
123 | |||
124 | /** |
||
125 | * Outstanding results in an array. |
||
126 | * |
||
127 | * @return array |
||
128 | */ |
||
129 | 4 | public function toArray() |
|
146 | |||
147 | /** |
||
148 | * Search for the first result by name. |
||
149 | * |
||
150 | * @param $ruleName |
||
151 | * @return Result|null |
||
152 | */ |
||
153 | 4 | public function find($ruleName) |
|
172 | |||
173 | /** |
||
174 | * Search results by name. |
||
175 | * |
||
176 | * @param $ruleName |
||
177 | * @return Result|null |
||
178 | */ |
||
179 | 4 | public function findAll($ruleName) |
|
200 | } |
||
201 |