Beispiel #1
0
 /**
  * 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;
 }
Beispiel #2
0
 /**
  * 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);
     }
 }
Beispiel #3
0
 /**
  * Construct text node.
  * @param string $text Text.
  */
 public function __construct($text)
 {
     parent::__construct();
     $this->text = $text;
 }
Beispiel #4
0
 /**
  * Construct internal node.
  */
 public function __construct()
 {
     parent::__construct();
     $this->root = $this;
 }