Example #1
0
 public function enterTagAttribute(TagAttribute $node)
 {
     if (null !== ($name = $this->getString($node->getName()))) {
         if (isset($this->attrs[$name])) {
             if ('class' === $name || 'id' === $name) {
                 $orig = $this->attrs[$name]->getValue();
                 $new = $this->mergeClasses($orig, $node->getValue());
                 // Don't merge it if the value isn't const since it could
                 // be an array; which needs special handling at runtime.
                 // Also unset $this->attrs[$name] so that following
                 // class arguments do not get merged into this one.
                 if (!$new || !$new->isConst()) {
                     unset($this->attrs[$name]);
                     return;
                 }
                 $this->attrs[$name]->setValue($new);
                 $this->tag->removeAttribute($node);
             } else {
                 $this->tag->removeAttribute($this->attrs[$name]);
             }
         } else {
             $this->attrs[$name] = $node;
         }
     }
 }
Example #2
0
 public function __construct(array $position, NodeAbstract $value = null)
 {
     parent::__construct($position, null, $value);
 }