| 1 |
<?php |
| 2 |
|
| 3 |
namespace WPDeveloper\BetterDocs\Dependencies\PhpParser\Node\Stmt; |
| 4 |
|
| 5 |
use WPDeveloper\BetterDocs\Dependencies\PhpParser\Node; |
| 6 |
|
| 7 |
class If_ extends Node\Stmt |
| 8 |
{ |
| 9 |
/** @var Node\Expr Condition expression */ |
| 10 |
public $cond; |
| 11 |
/** @var Node[] 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(), array $attributes = array()) { |
| 29 |
parent::__construct($attributes); |
| 30 |
$this->cond = $cond; |
| 31 |
$this->stmts = isset($subNodes['stmts']) ? $subNodes['stmts'] : array(); |
| 32 |
$this->elseifs = isset($subNodes['elseifs']) ? $subNodes['elseifs'] : array(); |
| 33 |
$this->else = isset($subNodes['else']) ? $subNodes['else'] : null; |
| 34 |
} |
| 35 |
|
| 36 |
public function getSubNodeNames() { |
| 37 |
return array('cond', 'stmts', 'elseifs', 'else'); |
| 38 |
} |
| 39 |
} |
| 40 |
|