Example #1
0
 public function output()
 {
     $attributesString = '';
     $childrenString = '';
     /** @var \DOM\Attribute $attribute */
     foreach ($this->attributes->sort()->toArray() as &$attribute) {
         if (!in_array($attribute->getName(), array('id', 'class')) || !$attribute->isEmpty()) {
             $attributesString .= ' ' . $attribute->output();
         }
     }
     /** @var \DOM\Node $child */
     foreach ($this->children->toArray() as $child) {
         $childrenString .= $child->output();
     }
     return sprintf('<%s%s>%s</%s>', $this->name, $attributesString, $childrenString, $this->name);
 }