{ return $this->_children; } } class Leaf extends Component { public function Add(Component $Component) { throw new ComponentException("I can't append child to myself"); } public function GetChild($index) { throw new ComponentException("Child not exists"); } public function Operation() { print "I am leaf\n"; } public function Remove($index) { throw new ComponentException("Child not exists"); } public function GetChildren() { return array(); } } $composite = new Composite(); $composite->Add(new Leaf()); $composite->Operation();