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\Operators;
 3: 
 4: use Pharborist\ExpressionNode;
 5: use Pharborist\ParentNode;
 6: 
 7: /**
 8:  * A ternary operation.
 9:  *
10:  * For example, $condition ? $then : $else
11:  */
12: class TernaryOperationNode extends ParentNode implements ExpressionNode {
13:   /**
14:    * @var ExpressionNode
15:    */
16:   protected $condition;
17: 
18:   /**
19:    * @var ExpressionNode
20:    */
21:   protected $then;
22: 
23:   /**
24:    * @var ExpressionNode
25:    */
26:   protected $else;
27: 
28:   /**
29:    * @return ExpressionNode
30:    */
31:   public function getCondition() {
32:     return $this->condition;
33:   }
34: 
35:   /**
36:    * @param ExpressionNode $condition
37:    *
38:    * @return $this
39:    */
40:   public function setCondition(ExpressionNode $condition) {
41:     /** @var \Pharborist\Node $condition */
42:     $this->condition->replaceWith($condition);
43:     return $this;
44:   }
45: 
46:   /**
47:    * @return ExpressionNode
48:    */
49:   public function getThen() {
50:     return $this->then;
51:   }
52: 
53:   /**
54:    * @param ExpressionNode $then
55:    *
56:    * @return $this
57:    */
58:   public function setThen(ExpressionNode $then) {
59:     /** @var \Pharborist\Node $then */
60:     $this->then->replaceWith($then);
61:     return $this;
62:   }
63: 
64:   /**
65:    * @return ExpressionNode
66:    */
67:   public function getElse() {
68:     return $this->else;
69:   }
70: 
71:   /**
72:    * @param ExpressionNode $else
73:    *
74:    * @return $this
75:    */
76:   public function setElse(ExpressionNode $else) {
77:     /** @var \Pharborist\Node $else */
78:     $this->condition->replaceWith($else);
79:     return $this;
80:   }
81: }
82: 
Pharborist API documentation generated by ApiGen