Debian Codegraph @

vendor/mck89/peast/lib/Peast/Syntax/Node/ForInStatement.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-in statement.
14 * For example: for (var a in b) {}
15 *
16 * @author Marco Marchiò <[email protected]>
17 */
18 class ForInStatement extends Node implements Statement
19 {
20 /**
21 * Map of node properties
22 *
23 * @var array
24 */
25 protected $propertiesMap = array(
26 "left" => true,
27 "right" => true,
28 "body" => true
29 );
30
31 /**
32 * Iteration variable
33 *
34 * @var VariableDeclaration|Expression|Pattern
35 */
36 protected $left;
37
38 /**
39 * Iterated object
40 *
41 * @var Expression
42 */
43 protected $right;
44
45 /**
46 * Loop body
47 *
48 * @var Statement
49 */
50 protected $body;
51
52 /**
53 * Returns the iteration variable
54 *
55 * @return VariableDeclaration|Expression|Pattern
56 */
57 public function getLeft()
58 {
59 return $this->left;
60 }
61
62 /**
63 * Sets the iteration variable
64 *
65 * @param VariableDeclaration|Expression|Pattern $left Iteration variable
66 *
67 * @return $this
68 */
69 public function setLeft($left)
70 {
71 $this->assertType(
72 $left, array("VariableDeclaration", "Expression", "Pattern")
73 );
74 $this->left = $left;
75 return $this;
76 }
77
78 /**
79 * Returns the iterated object
80 *
81 * @return Expression
82 */
83 public function getRight()
84 {
85 return $this->right;
86 }
87
88 /**
89 * Sets the iterated object
90 *
91 * @param Expression $right Iterated object
92 *
93 * @return $this
94 */
95 public function setRight(Expression $right)
96 {
97 $this->right = $right;
98 return $this;
99 }
100
101 /**
102 * Returns the loop body
103 *
104 * @return Statement
105 */
106 public function getBody()
107 {
108 return $this->body;
109 }
110
111 /**
112 * Sets the loop body
113 *
114 * @param Statement $body Loop body
115 *
116 * @return $this
117 */
118 public function setBody(Statement $body)
119 {
120 $this->body = $body;
121 return $this;
122 }
123 }