Sha256: 28f4c202c2bd8a80958b27749fb1fe693810f213d659e1176782dc20cb989223

Contents?: true

Size: 1.26 KB

Versions: 3

Compression:

Stored size: 1.26 KB

Contents

<?php
/* SVN FILE: $Id: HamlFilterNode.php 49 2010-04-04 10:51:24Z chris.l.yates $ */
/**
 * HamlFilterNode 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
 */

/**
 * HamlFilterNode class.
 * Represent a filter in the Haml source.
 * The filter is run on the output from child nodes when the node is rendered.
 * @package			PHamlP
 * @subpackage	Haml.tree
 */
class HamlFilterNode extends HamlNode {
	/**
	 * @var HamlBaseFilter the filter to run
	 */
	private $filter;

	/**
	 * HamlFilterNode constructor.
	 * Sets the filter.
	 * @param HamlBaseFilter the filter to run
	 * @return HamlFilterNode
	 */
	public function __construct($filter, $parent) {
	  $this->filter = $filter;	  
	  $this->parent = $parent;
	  $this->root = $parent->root;
	  $parent->children[] = $this;
	}

	/**
	* Render this node.
	* The filter is run on the content of child nodes before being returned.
	* @return string the rendered node
	*/
	public function render() {
		$output = '';
		foreach ($this->children as $child) {
			$output .= $child->getContent();
		} // foreach
		return $this->debug($this->filter->run($output));
	}
}

Version data entries

3 entries across 3 versions & 1 rubygems

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