PageRenderTime 107ms CodeModel.GetById 98ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/framework/experimental/graphic/GraphicContainer.php

http://zoop.googlecode.com/
PHP | 32 lines | 28 code | 4 blank | 0 comment | 1 complexity | 997e73dcbaa96917e866418fe898e372 MD5 | raw file
 1<?php
 2abstract class GraphicContainer extends GraphicObject
 3{
 4	protected $children = array();
 5	
 6	function getNewChild($type)
 7	{
 8		$newChild = new $type($this);
 9		assert(is_a($newChild, 'GraphicObject'));
10		$this->children[] = $newChild;
11		return $newChild;
12	}
13	
14	function isInline()
15	{
16		return false;
17	}
18	
19	function getObjectTree($indentLevel = 0)
20	{
21		$tabs = '';
22		for($i = 0; $i < $indentLevel; $i++)
23			$tabs .= '&nbsp;&nbsp;&nbsp;&nbsp;';
24		
25		echo $tabs . '&lt;' . get_class($this) . '&gt;<br>';
26		foreach($this->children as $thisChild)
27		{
28			$thisChild->getObjectTree($indentLevel + 1);
29		}
30		echo $tabs . '&lt;/' . get_class($this) . '&gt;<br>';
31	}
32}