Debian Codegraph @

vendor/mck89/peast/lib/Peast/Syntax/Node/TryStatement.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 try-catch statement.
14 *
15 * @author Marco Marchiò <[email protected]>
16 */
17 class TryStatement extends Node implements Statement
18 {
19 /**
20 * Map of node properties
21 *
22 * @var array
23 */
24 protected $propertiesMap = array(
25 "block" => true,
26 "handler" => true,
27 "finalizer" => true
28 );
29
30 /**
31 * Wrapped block
32 *
33 * @var BlockStatement
34 */
35 protected $block;
36
37 /**
38 * Catch clause
39 *
40 * @var CatchClause
41 */
42 protected $handler;
43
44 /**
45 * "finally" block
46 *
47 * @var BlockStatement
48 */
49 protected $finalizer;
50
51 /**
52 * Returns the wrapped block
53 *
54 * @return BlockStatement
55 */
56 public function getBlock()
57 {
58 return $this->block;
59 }
60
61 /**
62 * Sets the wrapped block
63 *
64 * @param BlockStatement $block Wrapped block
65 *
66 * @return $this
67 */
68 public function setBlock(BlockStatement $block)
69 {
70 $this->block = $block;
71 return $this;
72 }
73
74 /**
75 * Returns the catch clause
76 *
77 * @return CatchClause
78 */
79 public function getHandler()
80 {
81 return $this->handler;
82 }
83
84 /**
85 * Sets the catch clause
86 *
87 * @param CatchClause $handler Catch clause
88 *
89 * @return $this
90 */
91 public function setHandler($handler)
92 {
93 $this->assertType($handler, "CatchClause", true);
94 $this->handler = $handler;
95 return $this;
96 }
97
98 /**
99 * Returns the "finally" block
100 *
101 * @return BlockStatement
102 */
103 public function getFinalizer()
104 {
105 return $this->finalizer;
106 }
107
108 /**
109 * Sets the "finally" block
110 *
111 * @param BlockStatement $finalizer The "finally" block
112 *
113 * @return $this
114 */
115 public function setFinalizer($finalizer)
116 {
117 $this->assertType($finalizer, "BlockStatement", true);
118 $this->finalizer = $finalizer;
119 return $this;
120 }
121 }