Sha256: d1ba88aef94164f79cfd259092418cb2b7e252a835301c8184d708d06b4609a8

Contents?: true

Size: 514 Bytes

Versions: 10

Compression:

Stored size: 514 Bytes

Contents

<?php

namespace MtHaml\NodeVisitor;

use MtHaml\Node\Tag;

class Autoclose extends NodeVisitorAbstract
{
    protected $autocloseTags;

    public function __construct(array $autocloseTags)
    {
        $this->autocloseTags = $autocloseTags;
    }

    public function enterTag(Tag $tag)
    {
        if ($tag->hasChilds() || $tag->hasContent()) {
            return;
        }
        if (in_array($tag->getTagName(), $this->autocloseTags)) {
            $tag->setFlag(Tag::FLAG_SELF_CLOSE);
        }
    }
}

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
guard-mthaml-0.4.0 vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/Autoclose.php
guard-mthaml-0.3.1 vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/Autoclose.php
guard-mthaml-0.3.0 vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/Autoclose.php
guard-mthaml-0.2.5 vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/Autoclose.php
guard-mthaml-0.2.4 vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/Autoclose.php
guard-mthaml-0.2.3 vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/Autoclose.php
guard-mthaml-0.2.2 vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/Autoclose.php
guard-mthaml-0.2.1 vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/Autoclose.php
guard-mthaml-0.2.0 vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/Autoclose.php
guard-mthaml-0.1.0 vendor/mthaml/mthaml/lib/MtHaml/NodeVisitor/Autoclose.php