Exemplo n.º 1
0
 public function hasStatements()
 {
     if (!$this->parent instanceof Root) {
         return true;
     }
     return $this->parent->hasChilds();
 }
Exemplo n.º 2
0
 protected function setEscape(NodeAbstract $node, $mode)
 {
     switch ($mode) {
         case self::ESCAPE_FALSE:
             $node->getEscaping()->setEnabled(false);
             break;
         case self::ESCAPE_ONCE:
             $node->getEscaping()->setEnabled(true)->setOnce(true);
             break;
         case self::ESCAPE_TRUE:
             $node->getEscaping()->setEnabled(true);
             break;
     }
 }
 public function addChild(NodeAbstract $node)
 {
     if (!$this->allowsNestingAndContent() && $this->hasContent()) {
         throw new Exception('A node cannot have both content and nested nodes');
     }
     if (null !== ($parent = $node->getParent())) {
         $parent->removeChild($node);
     }
     $prev = end($this->childs) ?: null;
     $this->childs[] = $node;
     $node->setParent($this);
     if ($prev) {
         $prev->setNextSibling($node);
     }
     $node->setPreviousSibling($prev);
     $node->setNextSibling(null);
 }
Exemplo n.º 4
0
 public function compile(Environment $env, NodeAbstract $node)
 {
     $renderer = $this->createRenderer($env, array());
     $node->accept($renderer);
     return $renderer->getOutput();
 }
 public function __construct(array $position, $doctypeId, $options)
 {
     parent::__construct($position);
     $this->doctypeId = $doctypeId;
     $this->options = $options;
 }
 public function __construct(array $position, NodeAbstract $name = null, NodeAbstract $value = null)
 {
     parent::__construct($position);
     $this->name = $name;
     $this->value = $value;
 }
 protected function shouldIndentBeforeClose(NodeAbstract $node)
 {
     if ($node instanceof Tag) {
         if ($node->getFlags() & Tag::FLAG_REMOVE_INNER_WHITESPACES) {
             return false;
         }
         if (!$node->hasChilds()) {
             return false;
         }
     }
     if (null !== ($child = $this->getLastChildIfTag($node))) {
         if ($child->getFlags() & Tag::FLAG_REMOVE_OUTER_WHITESPACES) {
             return false;
         }
     }
     return true;
 }
Exemplo n.º 8
0
 public function __construct($position, NodeAbstract $object, NodeAbstract $prefix = null)
 {
     parent::__construct($position);
     $this->object = $object;
     $this->prefix = $prefix;
 }
 public function __construct(array $position, NodeAbstract $content)
 {
     parent::__construct($position);
     $this->content = $content;
 }
Exemplo n.º 10
0
 public function __construct(array $position, $filter)
 {
     parent::__construct($position);
     $this->filter = $filter;
 }
 public function __construct(array $position, array $childs = array())
 {
     parent::__construct($position);
     $this->childs = $childs;
 }