class firstclass
{
public function bar($pattern, $data = null, $fetch = null, $prefix = null)
{
echo "$pattern - is pattern \n";
print_r($data);
echo "|^| is data \n";
echo "$fetch - is fetch \n";
echo "$prefix - is prefix \n";
}
}
class secondclass extends firstclass
{
public function bar($pattern, $data=null, $fetch=null, $prefix=null)
{
$a = func_get_args();
$message = array_pop($a);
echo "The message was \"$message\" \n-----------------------\n";
/*
Do something with this message...
*/
call_user_func_array("parent::bar", $a);
}
}
$obj = new secondclass();
$obj->bar('ptrn', array('data', 'data2'), 'ftch', 'prfx' ,'This message must to be last in the parameters.');
$obj->bar('ptrn', array('data', 'data2'), 'Just another message.');
firstclass менять не можем - это сторонняя библиотека.
Костыли, или сойдет?