src/core/framework/core/3rdparty/dwoo/Dwoo/Compiler.php
public function &findBlock($type, $closeAlong = false)
	{
		if ($closeAlong===true) {
			while ($b = end($this->stack)) {
				if ($b['type']===$type) {
					return $this->stack[key($this->stack)];
				}
				$this->push($this->removeTopBlock(), 0);
			}
		} else {
			end($this->stack);
			while ($b = current($this->stack)) {
				if ($b['type']===$type) {
					return $this->stack[key($this->stack)];
				}
				prev($this->stack);
			}
		}

		throw new Dwoo_Compilation_Exception($this, 'A parent block of type "'.$type.'" is required and can not be found');
	}
public function &findBlock($type, $closeAlong = false)
	{
		if ($closeAlong===true) {
			while ($b = end($this->stack)) {
				if ($b['type']===$type) {
					return $this->stack[key($this->stack)];
				}
				$this->push($this->removeTopBlock(), 0);
			}
		} else {
			end($this->stack);
			while ($b = current($this->stack)) {
				if ($b['type']===$type) {
					return $this->stack[key($this->stack)];
				}
				prev($this->stack);
			}
		}

		throw new Dwoo_Compilation_Exception($this, 'A parent block of type "'.$type.'" is required and can not be found');
	}
public function & findBlock ( $ type , $ closeAlong = false ) { if ( $ closeAlong === true ) { while ( $ b = end ( $ this -> stack ) ) { if ( $ b [ 'type' ] === $ type ) { return $ this -> stack [ key ( $ this -> stack ) ] ; } $ this -> push ( $ this -> removeTopBlock ( ) , 0 ) ; } } else { end ( $ this -> stack ) ; while ( $ b = current ( $ this -> stack ) ) { if ( $ b [ 'type' ] === $ type ) { return $ this -> stack [ key ( $ this -> stack ) ] ; } prev ( $ this -> stack ) ; } } throw new Dwoo_Compilation_Exception ( $ this , 'A parent block of type "' . $ type . '" is required and can not be found' ) ; }
returns a reference to the first block of the given type encountered and
optionally closes all blocks until it finds it

this is mainly used by {else} plugins to close everything that was opened
between their parent and themselves

@param string $type the block type (name)
@param bool $closeAlong whether to close all blocks encountered while going down the block stack or not
@return &array the array is as such: array('type'=>pluginName, 'params'=>parameter array,
'custom'=>bool defining whether it's a custom plugin or not, for internal use)
returns a reference to the first block of the given type encountered and optionally closes all blocks until it finds it