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\Types;
 3: 
 4: use Pharborist\Node;
 5: use Pharborist\ParentNode;
 6: use Pharborist\Token;
 7: 
 8: /**
 9:  * A key/value pair element in php array.
10:  */
11: class ArrayPairNode extends ParentNode implements ArrayElementNode {
12:   /**
13:    * @var Node
14:    */
15:   protected $key;
16: 
17:   /**
18:    * @var Node
19:    */
20:   protected $value;
21: 
22:   /**
23:    * @return Node
24:    */
25:   public function getKey() {
26:     return $this->key;
27:   }
28: 
29:   /**
30:    * @return Node
31:    */
32:   public function getValue() {
33:     return $this->value;
34:   }
35: 
36:   /**
37:    * @param Node $key
38:    *   Array element's key.
39:    * @param Node $value
40:    *   Array element's value.
41:    *
42:    * @return ArrayPairNode
43:    */
44:   public static function create($key, $value) {
45:     $node = new ArrayPairNode();
46:     $node->addChild($key, 'key');
47:     $node->addChild(Token::space());
48:     $node->addChild(Token::doubleArrow());
49:     $node->addChild(Token::space());
50:     $node->addChild($value, 'value');
51:     return $node;
52:   }
53: }
54: 
Pharborist API documentation generated by ApiGen