Sha256: 94fe8fb64ebcefaaecf1695844a8f6ebd3904faaa6c60f5e8ed9f35ce26d67ed

Contents?: true

Size: 1.36 KB

Versions: 3

Compression:

Stored size: 1.36 KB

Contents

<?php
/* SVN FILE: $Id: HamlRootNode.php 49 2010-04-04 10:51:24Z chris.l.yates $ */
/**
 * HamlRootNode class file.
 * @author			Chris Yates <chris.l.yates@gmail.com>
 * @copyright 	Copyright (c) 2010 PBM Web Development
 * @license			http://phamlp.googlecode.com/files/license.txt
 * @package			PHamlP
 * @subpackage	Haml.tree
 */

require_once(dirname(__FILE__).'/../renderers/HamlRenderer.php');

/**
 * HamlRootNode class.
 * Also the root node of a document.
 * @package			PHamlP
 * @subpackage	Haml.tree
 */
class HamlRootNode extends HamlNode {
	/**
	 * @var HamlRenderer the renderer for this node
	 */
	protected $renderer;
	/**
	 * @var array options
	 */
	protected $options;

	/**
	 * Root HamlNode constructor.
	 * @param array options for the tree
	 * @return HamlNode
	 */
	public function __construct($options) {
		$this->root = $this;
		$this->options = $options;
		$this->renderer = HamlRenderer::getRenderer($this->options['style'],
			array(
				'format' => $this->options['format'],
				'attrWrapper' => $this->options['attrWrapper'],
				'minimizedAttributes' => $this->options['minimizedAttributes'],
			)
		);
		$this->token = array('level' => -1);
	}

	/**
	 * Render this node.
	 * @return string the rendered node
	 */
	public function render() {
		foreach ($this->children as $child) {
			$this->output .= $child->render();
		} // foreach
		return $this->output;
	}
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
frontsau-0.0.3 lib/Phamlp/haml/tree/HamlRootNode.php
frontsau-0.0.2 lib/Phamlp/haml/tree/HamlRootNode.php
frontsau-0.0.1 lib/Phamlp/haml/tree/HamlRootNode.php