![Picture of Kai Dorschner Picture of Kai Dorschner](/picture/user/484120.png)
Kai Dorschner - 2011-09-08 10:39:46 -
In reply to message 3 from Stefan Jibrail Froelich
Not only the call would be faster, you can use my mentioned example in another class. Yours not. Zend did this on purpose, otherwise they would have found a similar solution like yours. You might also extend functions with array parameters:
cass Foo
{
function foo(array $params = array())
{
if(isset($params['foo']) $this->doStuff();
}
protected function doStuff()
{
echo 'stuff'.PHP_EOL;
}
}
class Bar
{
function foo(array $params = array())
{
parent::foo($params);
if(isset($params['bar']) $this->doMoreStuff();
}
protected function doMoreStuff()
{
echo 'more stuff'.PHP_EOL;
}
}
$x = new Bar();
$x->foo(array('foo' => 'john', 'bar' => 'doe'));
//Output:
/*
stuff
more stuff
*/