protected function addPrepareVars(&$hook, &$callback, &$file) { $className = 'Am_Event_' . ucfirst($hook); // Commented out - we need to place Am_Event classes to outside of loaded core // if (!class_exists($className, false)) // throw new Am_Exception_InternalError("Could not add hook, class $className does not exists"); // // $reflection = new ReflectionClass($className); // if ($reflection->isAbstract()) // throw new Am_Exception_InternalError("Could not add hook, class $className is abstract"); $strongName = lcfirst(substr($className, strlen('Am_Event_'))); // $strongName = lcfirst(substr($reflection->getName(), strlen('Am_Event_'))); if (strcmp($strongName, $hook)) { throw new Am_Exception_InternalError("Could not add hook, hookname case is incorrect, must be exactly [{$strongName}], passed [{$hook}]"); } if (!is_callable($callback, $file != null)) { throw new Am_Exception_InternalError("Could not add hook, callback provided [" . Am_HookCallback::static_getSignature($callback) . "] is not callable"); } if ($file !== null) { $rfile = $this->_getRelativePath($file); if (!$rfile) { throw new Am_Exception_InternalError("Could not add hook, path provided is not relative [" . htmlentities($file) . "]"); } $file = $rfile; } }
/** * Do call of a single callback, it is an internal functions * @access protected */ public function call(Am_HookCallback $callback) { try { $ret = call_user_func($callback->getCallback(), $this); } catch (Exception $e) { $this->addRaisedException($callback->getSignature(), $e); $e = $this->onException($e); if ($e) { throw $e; } return; } return $ret; }