Sha256: 931ce56a52e40a4e23d0652152b293d62e04be5c94ead8bf6535ab9778f01538

Contents?: true

Size: 1.03 KB

Versions: 10

Compression:

Stored size: 1.03 KB

Contents

<?php

namespace MtHaml\Filter;

use MtHaml\NodeVisitor\RendererAbstract as Renderer;
use MtHaml\Node\Filter;
use MtHaml\Node\Insert;

abstract class AbstractFilter implements FilterInterface
{
    public function isOptimizable(Renderer $renderer, Filter $node, $options)
    {
        foreach ($node->getChilds() as $line) {
            foreach ($line->getContent()->getChilds() as $child) {
                if ($child instanceof Insert) {
                    return false;
                }
            }
        }

        return true;
    }

    protected function renderFilter(Renderer $renderer, Filter $node)
    {
        foreach ($node->getChilds() as $child) {
            $child->accept($renderer);
        }
    }

    protected function getContent(Filter $node)
    {
        $content = '';
        foreach ($node->getChilds() as $line) {
            foreach ($line->getContent()->getChilds() as $child) {
                $content .= $child->getContent();
            }
            $content .= "\n";
        }

        return $content;
    }
}

Version data entries

10 entries across 10 versions & 1 rubygems

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