Debian Codegraph @

vendor/mck89/peast/lib/Peast/Syntax/Node/ForStatement.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 for statement.
14 *
15 * @author Marco Marchiò <[email protected]>
16 */
17 class ForStatement extends Node implements Statement
18 {
19 /**
20 * Map of node properties
21 *
22 * @var array
23 */
24 protected $propertiesMap = array(
25 "init" => true,
26 "test" => true,
27 "update" => true,
28 "body" => true
29 );
30
31 /**
32 * Initializer
33 *
34 * @var VariableDeclaration|Expression
35 */
36 protected $init;
37
38 /**
39 * Test expression
40 *
41 * @var Expression
42 */
43 protected $test;
44
45 /**
46 * Update expression
47 *
48 * @var Expression
49 */
50 protected $update;
51
52 /**
53 * Loop body
54 *
55 * @var Statement
56 */
57 protected $body;
58
59 /**
60 * Returns the initializer
61 *
62 * @return VariableDeclaration|Expression
63 */
64 public function getInit()
65 {
66 return $this->init;
67 }
68
69 /**
70 * Sets the initializer
71 *
72 * @param VariableDeclaration|Expression $init Initializer
73 *
74 * @return $this
75 */
76 public function setInit($init)
77 {
78 $this->assertType(
79 $init,
80 array("VariableDeclaration", "Expression"),
81 true
82 );
83 $this->init = $init;
84 return $this;
85 }
86
87 /**
88 * Returns the test expression
89 *
90 * @return Expression
91 */
92 public function getTest()
93 {
94 return $this->test;
95 }
96
97 /**
98 * Sets the test expression
99 *
100 * @param Expression $test Test expression
101 *
102 * @return $this
103 */
104 public function setTest($test)
105 {
106 $this->assertType($test, "Expression", true);
107 $this->test = $test;
108 return $this;
109 }
110
111 /**
112 * Returns the update expression
113 *
114 * @return Expression
115 */
116 public function getUpdate()
117 {
118 return $this->update;
119 }
120
121 /**
122 * Sets the update expression
123 *
124 * @param Expression $update Update expression
125 *
126 * @return $this
127 */
128 public function setUpdate($update)
129 {
130 $this->assertType($update, "Expression", true);
131 $this->update = $update;
132 return $this;
133 }
134
135 /**
136 * Returns the loop body
137 *
138 * @return Statement
139 */
140 public function getBody()
141 {
142 return $this->body;
143 }
144
145 /**
146 * Sets the loop body
147 *
148 * @param Statement $body Loop body
149 *
150 * @return $this
151 */
152 public function setBody(Statement $body)
153 {
154 $this->body = $body;
155 return $this;
156 }
157 }