public function __call($method, $arguments)
{
if (self::___debug) {
static $timers = array();
$timerName = get_class($this) . "::{$method}";
$notes = array();
foreach ($arguments as $argument) {
if (is_object($argument)) {
$notes[] = get_class($argument);
} else {
if (is_array($argument)) {
$notes[] = "array(" . count($argument) . ")";
} else {
if (strlen($argument) > 20) {
$notes[] = substr($argument, 0, 20) . '...';
}
}
}
}
$timerName .= "(" . implode(', ', $notes) . ")";
if (isset($timers[$timerName])) {
$timers[$timerName]++;
$timerName .= " #" . $timers[$timerName];
} else {
$timers[$timerName] = 1;
}
Debug::timer($timerName);
$result = $this->runHooks($method, $arguments);
Debug::saveTimer($timerName);
} else {
$result = $this->runHooks($method, $arguments);
}
if (!$result['methodExists'] && !$result['numHooksRun']) {
return $this->callUnknown($method, $arguments);
}
return $result['return'];
}