Debian Codegraph @

vendor/mck89/peast/lib/Peast/Syntax/Node/SwitchStatement.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 switch statement.
14 * For example: switch (test) {}
15 *
16 * @author Marco Marchiò <[email protected]>
17 */
18 class SwitchStatement extends Node implements Statement
19 {
20 /**
21 * Map of node properties
22 *
23 * @var array
24 */
25 protected $propertiesMap = array(
26 "discriminant" => true,
27 "cases" => true
28 );
29
30 /**
31 * Discriminant expression
32 *
33 * @var Expression
34 */
35 protected $discriminant;
36
37 /**
38 * Cases array
39 *
40 * @var SwitchCase[]
41 */
42 protected $cases = array();
43
44 /**
45 * Returns the discriminant expression
46 *
47 * @return Expression
48 */
49 public function getDiscriminant()
50 {
51 return $this->discriminant;
52 }
53
54 /**
55 * Sets the discriminant expression
56 *
57 * @param Expression $discriminant Discriminant expression
58 *
59 * @return $this
60 */
61 public function setDiscriminant(Expression $discriminant)
62 {
63 $this->discriminant = $discriminant;
64 return $this;
65 }
66
67 /**
68 * Returns the cases array
69 *
70 * @return SwitchCase[]
71 */
72 public function getCases()
73 {
74 return $this->cases;
75 }
76
77 /**
78 * Sets the cases array
79 *
80 * @param SwitchCase[] $cases Cases array
81 *
82 * @return $this
83 */
84 public function setCases($cases)
85 {
86 $this->assertArrayOf($cases, "SwitchCase");
87 $this->cases = $cases;
88 return $this;
89 }
90 }