This repository has been archived by the owner on Jul 4, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
decoupled the exception handler from HttpKernelServiceProvider
- Loading branch information
Showing
4 changed files
with
35 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
namespace Silex\Provider; | ||
|
||
use Pimple\Container; | ||
use Pimple\ServiceProviderInterface; | ||
use Silex\Api\EventListenerProviderInterface; | ||
use Silex\ExceptionHandler; | ||
use Symfony\Component\EventDispatcher\EventDispatcherInterface; | ||
|
||
class ExceptionHandlerServiceProvider implements ServiceProviderInterface, EventListenerProviderInterface | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function register(Container $app) | ||
{ | ||
$app['exception_handler'] = function ($app) { | ||
return new ExceptionHandler($app['debug']); | ||
}; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function subscribe(Container $app, EventDispatcherInterface $dispatcher) | ||
{ | ||
if (isset($app['exception_handler'])) { | ||
$dispatcher->addSubscriber($app['exception_handler']); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters