src/DecoratorStack.php
public function apply(Tag $tag, Renderer $renderer)
    {
        foreach ($this->stack as $item) {
            $result = $item['decorator']($tag, $renderer);
            // in case a decorator returns something unexpected
            if ($result instanceof Tag) {
                $tag = $result;
            } else {
                trigger_error(sprintf('%s does not return an instance of Sirius\\Html\\Tag',
                    get_class($item['decorator'])), E_USER_WARNING);
            }
        }

        return $tag;
    }
public function apply(Tag $tag, Renderer $renderer)
    {
        foreach ($this->stack as $item) {
            $result = $item['decorator']($tag, $renderer);
            // in case a decorator returns something unexpected
            if ($result instanceof Tag) {
                $tag = $result;
            } else {
                trigger_error(sprintf('%s does not return an instance of Sirius\\Html\\Tag',
                    get_class($item['decorator'])), E_USER_WARNING);
            }
        }

        return $tag;
    }
Apply the decorators to a tag produced by a renderer

@param Tag $tag
@param Renderer $renderer
@return Tag