菜谱项目

Ternary.php 880B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace PhpParser\Node\Expr;
  3. use PhpParser\Node\Expr;
  4. class Ternary extends Expr
  5. {
  6. /** @var Expr Condition */
  7. public $cond;
  8. /** @var null|Expr Expression for true */
  9. public $if;
  10. /** @var Expr Expression for false */
  11. public $else;
  12. /**
  13. * Constructs a ternary operator node.
  14. *
  15. * @param Expr $cond Condition
  16. * @param null|Expr $if Expression for true
  17. * @param Expr $else Expression for false
  18. * @param array $attributes Additional attributes
  19. */
  20. public function __construct(Expr $cond, $if, Expr $else, array $attributes = array()) {
  21. parent::__construct($attributes);
  22. $this->cond = $cond;
  23. $this->if = $if;
  24. $this->else = $else;
  25. }
  26. public function getSubNodeNames() {
  27. return array('cond', 'if', 'else');
  28. }
  29. }