| @@ 173-177 (lines=5) @@ | ||
| 170 | ||
| 171 | public function each(callable $fn) |
|
| 172 | { |
|
| 173 | foreach ($this->nodes as $i => $n) { |
|
| 174 | $cx = $this->newContext($n); |
|
| 175 | ||
| 176 | $this->callfn($fn, [$cx, $i, $n]); |
|
| 177 | } |
|
| 178 | ||
| 179 | return $this; |
|
| 180 | } |
|
| @@ 186-190 (lines=5) @@ | ||
| 183 | { |
|
| 184 | $result = []; |
|
| 185 | ||
| 186 | foreach ($this->nodes as $i => $n) { |
|
| 187 | $cx = $this->newContext($n); |
|
| 188 | ||
| 189 | $result[] = $this->callfn($fn, [$cx, $i, $n]); |
|
| 190 | } |
|
| 191 | ||
| 192 | return $result; |
|
| 193 | } |
|