If.php 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /**
  3. * @property PHPParser_Node_Expr $cond Condition expression
  4. * @property PHPParser_Node[] $stmts Statements
  5. * @property PHPParser_Node_Stmt_ElseIf[] $elseifs Elseif clauses
  6. * @property null|PHPParser_Node_Stmt_Else $else Else clause
  7. */
  8. class PHPParser_Node_Stmt_If extends PHPParser_Node_Stmt
  9. {
  10. /**
  11. * Constructs an if node.
  12. *
  13. * @param PHPParser_Node_Expr $cond Condition
  14. * @param array $subNodes Array of the following optional subnodes:
  15. * 'stmts' => array(): Statements
  16. * 'elseifs' => array(): Elseif clauses
  17. * 'else' => null : Else clause
  18. * @param array $attributes Additional attributes
  19. */
  20. public function __construct(PHPParser_Node_Expr $cond, array $subNodes = array(), array $attributes = array()) {
  21. parent::__construct(
  22. $subNodes + array(
  23. 'stmts' => array(),
  24. 'elseifs' => array(),
  25. 'else' => null,
  26. ),
  27. $attributes
  28. );
  29. $this->cond = $cond;
  30. }
  31. }