本文整理汇总了PHP中Zend\EventManager\EventInterface::getResult方法的典型用法代码示例。如果您正苦于以下问题:PHP EventInterface::getResult方法的具体用法?PHP EventInterface::getResult怎么用?PHP EventInterface::getResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\EventManager\EventInterface
的用法示例。
在下文中一共展示了EventInterface::getResult方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onBootstrap
public function onBootstrap(EventInterface $event)
{
/** @var \Zend\Mvc\ApplicationInterface $application */
$application = $event->getApplication();
/** @var \Yassa\Rollbar\Options\ModuleOptions $options */
$options = $application->getServiceManager()->get('Yassa\\Rollbar\\Options\\ModuleOptions');
if ($options->enabled) {
/** @var RollbarNotifier $rollbar */
$rollbar = $application->getServiceManager()->get('RollbarNotifier');
if ($options->exceptionhandler) {
set_exception_handler(array($rollbar, "report_exception"));
$eventManager = $application->getEventManager();
$eventManager->attach('dispatch.error', function ($event) use($rollbar) {
$exception = $event->getResult()->exception;
if ($exception) {
$rollbar->report_exception($exception);
}
});
}
if ($options->errorhandler) {
set_error_handler(array($rollbar, "report_php_error"));
}
if ($options->shutdownfunction) {
register_shutdown_function($this->shutdownHandler($rollbar));
}
}
}
示例2: log
/**
*
* @param EventInterface $event
*/
public function log(EventInterface $event)
{
$exception = $event->getResult()->exception;
if (!$exception) {
return;
}
$trace = $exception->getTraceAsString();
$i = 1;
do {
$messages[] = $i++ . ": " . $exception->getMessage();
} while ($e = $exception->getPrevious());
$log = "Exception:n" . implode("n", $messages);
$log .= "nTrace:n" . $trace;
$this->logger->err($log);
}