/** * Construct PHP expression or statement. * @param string $code PHP code. * @param bool $statement True if statement, false if expression. */ public function __construct($code, $statement = false) { parent::__construct(); if (!$statement) { $code = rtrim(trim($code), ';'); } $this->code = $code; $this->statement = $statement; }
/** * Construct if statement. * @param string $condition Conditional expression. * @param TemplateNode $then True output. */ public function __construct($condition, TemplateNode $then = null) { parent::__construct(); $this->condition = $condition; $this->then = new InternalNode(); $this->else = new InternalNode(); if (isset($then)) { $this->then->append($then); } }
/** * Construct text node. * @param string $text Text. */ public function __construct($text) { parent::__construct(); $this->text = $text; }
/** * Construct internal node. */ public function __construct() { parent::__construct(); $this->root = $this; }