Overview

Namespaces

  • Pharborist
    • Constants
    • ControlStructures
    • Exceptions
    • Functions
    • Generators
    • Namespaces
    • Objects
    • Operators
    • Types
    • Variables

Classes

  • Pharborist\Variables\CompoundVariableNode
  • Pharborist\Variables\GlobalStatementNode
  • Pharborist\Variables\ReferenceVariableNode
  • Pharborist\Variables\StaticVariableNode
  • Pharborist\Variables\StaticVariableStatementNode
  • Pharborist\Variables\VariableNode
  • Pharborist\Variables\VariableVariableNode

Interfaces

  • Pharborist\Variables\VariableExpressionNode
  • Overview
  • Namespace
  • Class
 1: <?php
 2: namespace Pharborist\Functions;
 3: 
 4: use Pharborist\NodeCollection;
 5: 
 6: class ParameterNodeCollection extends NodeCollection {
 7:   /**
 8:    * Implements \ArrayAccess::offsetExists().
 9:    *
10:    * @param integer $offset
11:    *
12:    * @return boolean
13:    */
14:   public function offsetExists($offset) {
15:     if (is_string($offset)) {
16:       // To deal with php allowing function test($a, $a) loop in reverse.
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:    * Implements \ArrayAccess::offsetGet().
31:    *
32:    * @param integer $offset
33:    *
34:    * @return ParameterNode
35:    */
36:   public function offsetGet($offset) {
37:     if (is_string($offset)) {
38:       // To deal with php allowing function test($a, $a) loop in reverse.
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: 
Pharborist API documentation generated by ApiGen