1
0
mirror of https://github.com/danog/PHP-Parser.git synced 2024-12-11 17:09:41 +01:00
PHP-Parser/lib/PhpParser/Node/Stmt/If_.php
2014-04-02 09:44:45 +02:00

38 lines
1.3 KiB
PHP

<?php
namespace PhpParser\Node\Stmt;
use PhpParser\Node;
/**
* @property Node\Expr $cond Condition expression
* @property Node[] $stmts Statements
* @property Node\Stmt\ElseIf_[] $elseifs Elseif clauses
* @property null|Node\Stmt\Else_ $else Else clause
*/
class If_ extends Node\Stmt
{
/**
* Constructs an if node.
*
* @param Node\Expr $cond Condition
* @param array $subNodes Array of the following optional subnodes:
* 'stmts' => array(): Statements
* 'elseifs' => array(): Elseif clauses
* 'else' => null : Else clause
* @param array $attributes Additional attributes
*/
public function __construct(Node\Expr $cond, array $subNodes = array(), array $attributes = array()) {
parent::__construct(
array(
'cond' => $cond,
'stmts' => isset($subNodes['stmts']) ? $subNodes['stmts'] : array(),
'elseifs' => isset($subNodes['elseifs']) ? $subNodes['elseifs'] : array(),
'else' => isset($subNodes['else']) ? $subNodes['else'] : null,
),
$attributes
);
$this->cond = $cond;
}
}