Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 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
    /** @var Node\Expr Condition expression */
10
    public $cond;
11
    /** @var Node\Stmt[] Statements */
12
    public $stmts;
13
    /** @var ElseIf_[] Elseif clauses */
14
    public $elseifs;
15
    /** @var null|Else_ Else clause */
16
    public $else;
17
 
18
    /**
19
     * Constructs an if node.
20
     *
21
     * @param Node\Expr $cond       Condition
22
     * @param array     $subNodes   Array of the following optional subnodes:
23
     *                              'stmts'   => array(): Statements
24
     *                              'elseifs' => array(): Elseif clauses
25
     *                              'else'    => null   : Else clause
26
     * @param array     $attributes Additional attributes
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
}