1: <?php
2: namespace Pharborist\Functions;
3:
4: use Pharborist\NodeCollection;
5:
6: class ParameterNodeCollection extends NodeCollection {
7: 8: 9: 10: 11: 12: 13:
14: public function offsetExists($offset) {
15: if (is_string($offset)) {
16:
17: foreach (array_reverse($this->nodes) as $node) {
18: if ($node instanceof ParameterNode) {
19: if ($node->getName() === $offset) {
20: return TRUE;
21: }
22: }
23: }
24: return FALSE;
25: }
26: return isset($this->nodes[$offset]);
27: }
28:
29: 30: 31: 32: 33: 34: 35:
36: public function offsetGet($offset) {
37: if (is_string($offset)) {
38:
39: foreach (array_reverse($this->nodes) as $node) {
40: if ($node instanceof ParameterNode) {
41: if ($node->getName() === $offset) {
42: return $node;
43: }
44: }
45: }
46: return NULL;
47: }
48: return parent::offsetGet($offset);
49: }
50: }
51: