Usually we do use PEAR::raiseError() / $this->raiseError() for that. Did
I miss something?
For methods that don't exist, I'm calling trigger_error so that it is more in line with undefined methods treated by PHP.
For the others, I will use the PEAR scheme.
This was premature. I only use PEAR's raiseError.
Is the following error reporting to aggressive?
public function addDelegate($delegate)
{
$args = array_values(func_get_args());
foreach ($args as $delegate)
{
if (is_string($delegate) && class_exists($delegate))
{
$delegate = new $delegate;
}
else
{
$fileRecord = debug_backtrace();
$fileRecord = $fileRecord[0];
if (array_key_exists("file", $fileRecord))
{
$file = $fileRecord["file"];
$line = $fileRecord["line"];
}
else
{
$file = "unknown file";
$line = "unknown";
}
$this->raiseError("Fatal: Class '$delegate' not found in $file on line $line", -1, PEAR_ERROR_DIE);
}
$this->_delegates[get_class($delegate)] = $delegate;
}
}