mirror of
https://github.com/filp/whoops.git
synced 2026-09-13 03:06:20 +00:00
Zend Provider | Fix autoloader path
This commit is contained in:
@@ -2,18 +2,18 @@
|
||||
/**
|
||||
* ZF2 Integration for Whoops
|
||||
* @author Balázs Németh <zsilbi@zsilbi.hu>
|
||||
*
|
||||
*
|
||||
* The Whoops directory should be added as a module to ZF2 (/vendor/Whoops)
|
||||
*
|
||||
*
|
||||
* Whoops must be added as the first module
|
||||
* For example:
|
||||
* 'modules' => array(
|
||||
* 'Whoops',
|
||||
* 'Application',
|
||||
* ),
|
||||
*
|
||||
*
|
||||
* This file should be moved next to Whoops/Run.php (/vendor/Whoops/Module.php)
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Whoops;
|
||||
@@ -26,11 +26,12 @@ use Whoops\Handler\PrettyPageHandler;
|
||||
use Zend\EventManager\EventInterface;
|
||||
use Zend\Console\Request as ConsoleRequest;
|
||||
|
||||
class Module {
|
||||
|
||||
class Module
|
||||
{
|
||||
protected $run;
|
||||
|
||||
public function onBootstrap(EventInterface $event) {
|
||||
public function onBootstrap(EventInterface $event)
|
||||
{
|
||||
$prettyPageHandler = new PrettyPageHandler();
|
||||
|
||||
$this->run = new Run();
|
||||
@@ -40,17 +41,19 @@ class Module {
|
||||
$this->attachListeners($event);
|
||||
}
|
||||
|
||||
public function getAutoloaderConfig() {
|
||||
public function getAutoloaderConfig()
|
||||
{
|
||||
return array(
|
||||
'Zend\Loader\StandardAutoloader' => array(
|
||||
'namespaces' => array(
|
||||
__NAMESPACE__ => __DIR__,
|
||||
__NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
private function attachListeners(EventInterface $event) {
|
||||
private function attachListeners(EventInterface $event)
|
||||
{
|
||||
$request = $event->getRequest();
|
||||
$application = $event->getApplication();
|
||||
$services = $application->getServiceManager();
|
||||
@@ -64,7 +67,7 @@ class Module {
|
||||
$jsonHandler = new JsonResponseHandler();
|
||||
|
||||
if (!empty($config['view_manager']['json_exceptions']['show_trace'])) {
|
||||
//Add trace to the JSON output
|
||||
//Add trace to the JSON output
|
||||
$jsonHandler->addTraceToOutput(true);
|
||||
}
|
||||
|
||||
@@ -72,7 +75,7 @@ class Module {
|
||||
//Only return JSON response for AJAX requests
|
||||
$jsonHandler->onlyForAjaxRequests(true);
|
||||
}
|
||||
|
||||
|
||||
if (!empty($config['view_manager']['json_exceptions']['display'])) {
|
||||
//Turn on JSON handler
|
||||
$this->run->pushHandler($jsonHandler);
|
||||
@@ -93,4 +96,4 @@ class Module {
|
||||
$services->get('Zend\Mvc\View\Http\RouteNotFoundStrategy')->detach($events);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user