1: | <?php declare(strict_types=1); |
2: | |
3: | namespace PhpParser\Node\Stmt; |
4: | |
5: | use PhpParser\Node; |
6: | |
7: | class If_ extends Node\Stmt |
8: | { |
9: | |
10: | public $cond; |
11: | |
12: | public $stmts; |
13: | |
14: | public $elseifs; |
15: | |
16: | public $else; |
17: | |
18: | |
19: | |
20: | |
21: | |
22: | |
23: | |
24: | |
25: | |
26: | |
27: | |
28: | public function __construct(Node\Expr $cond, array $subNodes = [], array $attributes = []) { |
29: | $this->attributes = $attributes; |
30: | $this->cond = $cond; |
31: | $this->stmts = $subNodes['stmts'] ?? []; |
32: | $this->elseifs = $subNodes['elseifs'] ?? []; |
33: | $this->else = $subNodes['else'] ?? null; |
34: | } |
35: | |
36: | public function getSubNodeNames() : array { |
37: | return ['cond', 'stmts', 'elseifs', 'else']; |
38: | } |
39: | |
40: | public function getType() : string { |
41: | return 'Stmt_If'; |
42: | } |
43: | } |
44: | |