Debian Codegraph @

vendor/mck89/peast/lib/Peast/Syntax/Node/ConditionalExpression.php

raw
1 <?php
2 /**
3 * This file is part of the Peast package
4 *
5 * (c) Marco Marchiò <[email protected]>
6 *
7 * For the full copyright and license information refer to the LICENSE file
8 * distributed with this source code
9 */
10 namespace Peast\Syntax\Node;
11
12 /**
13 * A node that represents a conditional expression.
14 * For example: test() ? ok() : fail()
15 *
16 * @author Marco Marchiò <[email protected]>
17 */
18 class ConditionalExpression extends Node implements Expression
19 {
20 /**
21 * Map of node properties
22 *
23 * @var array
24 */
25 protected $propertiesMap = array(
26 "test" => true,
27 "consequent" => true,
28 "alternate" => true
29 );
30
31 /**
32 * The test expression
33 *
34 * @var Expression
35 */
36 protected $test;
37
38 /**
39 * The consequent expression
40 *
41 * @var Expression
42 */
43 protected $consequent;
44
45 /**
46 * The alternate expression
47 *
48 * @var Expression
49 */
50 protected $alternate;
51
52 /**
53 * Returns the test expression
54 *
55 * @return Expression
56 */
57 public function getTest()
58 {
59 return $this->test;
60 }
61
62 /**
63 * Sets the test expression
64 *
65 * @param Expression $test Test expression
66 *
67 * @return $this
68 */
69 public function setTest(Expression $test)
70 {
71 $this->test = $test;
72 return $this;
73 }
74
75 /**
76 * Returns the consequent expression
77 *
78 * @return Expression
79 */
80 public function getConsequent()
81 {
82 return $this->consequent;
83 }
84
85 /**
86 * Sets the consequent expression
87 *
88 * @param Expression $consequent Consequent expression
89 *
90 * @return $this
91 */
92 public function setConsequent(Expression $consequent)
93 {
94 $this->consequent = $consequent;
95 return $this;
96 }
97
98 /**
99 * Returns the alternate expression
100 *
101 * @return Expression
102 */
103 public function getAlternate()
104 {
105 return $this->alternate;
106 }
107
108 /**
109 * Sets the alternate expression
110 *
111 * @param Expression $alternate Alternate expression
112 *
113 * @return $this
114 */
115 public function setAlternate(Expression $alternate)
116 {
117 $this->alternate = $alternate;
118 return $this;
119 }
120 }