Sha256: d993b7573ac897b04ffea47b50bc3ed5cad930f9cfa564d809796fef2c56d820

Contents?: true

Size: 1.67 KB

Versions: 10

Compression:

Stored size: 1.67 KB

Contents

<?php

namespace MtHaml\Node;

use MtHaml\NodeVisitor\NodeVisitorInterface;

/**
 * Comment Node
 */
class Comment extends NestAbstract
{
    protected $rendered;
    protected $condition;

    /**
     * @param array  $position
     * @param bool   $rendered  Whether the comment is rendered in the
     *                          HTML output (as a HTML comment).
     * @param string $condition IE condition. If not null, the HTML comment
     *                          will be rendered as an IE conditional
     *                          comment.
     */
    public function __construct(array $position, $rendered, $condition = null)
    {
        parent::__construct($position);
        $this->rendered = $rendered;
        $this->condition = $condition;
    }

    public function isRendered()
    {
        return $this->rendered;
    }

    public function hasCondition()
    {
        return null !== $this->condition;
    }

    public function getCondition()
    {
        return $this->condition;
    }

    public function getNodeName()
    {
        return 'comment';
    }

    public function accept(NodeVisitorInterface $visitor)
    {
        if (false !== $visitor->enterComment($this)) {

            if (false !== $visitor->enterCommentContent($this)) {
                $this->visitContent($visitor);
            }
            $visitor->leaveCommentContent($this);

            if (false !== $visitor->enterCommentChilds($this)) {
                $this->visitChilds($visitor);
            }
            $visitor->leaveCommentChilds($this);
        }
        $visitor->leaveComment($this);
    }

    public function allowsNestingAndContent()
    {
        return ! $this->rendered;
    }
}

Version data entries

10 entries across 10 versions & 1 rubygems

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