Sha256: 6d76c3930c3e4f6a22895808d0e4260edbe3cab03db9f4f563d37e98121ab3c4

Contents?: true

Size: 1.53 KB

Versions: 10

Compression:

Stored size: 1.53 KB

Contents

<?php

namespace MtHaml\Node;

use MtHaml\NodeVisitor\NodeVisitorInterface;

/**
 * Run Node
 *
 * Represents code to execute. If there is children, the node should be
 * rendered as a block (the renderer should emit a properly closed block).
 */
class Run extends NestAbstract
{
    private $midblock;

    public function __construct(array $position, $content)
    {
        parent::__construct($position);
        $this->setContent($content);
    }

    public function allowsNestingAndContent()
    {
        return true;
    }

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

    public function setMidblock(Run $midblock = null)
    {
        $this->midblock = $midblock;
    }

    public function getMidblock()
    {
        return $this->midblock;
    }

    public function hasMidblock()
    {
        return null !== $this->midblock;
    }

    public function isBlock()
    {
        return $this->hasChilds() || $this->hasMidblock();
    }

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

            if (false !== $visitor->enterRunChilds($this)) {
                $this->visitChilds($visitor);
            }
            $visitor->leaveRunChilds($this);

            if (false !== $visitor->enterRunMidblock($this)) {
                if (null !== $block = $this->getMidblock()) {
                    $block->accept($visitor);
                }
            }
            $visitor->leaveRunMidblock($this);
        }
        $visitor->leaveRun($this);
    }
}

Version data entries

10 entries across 10 versions & 1 rubygems

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