@@ -21,9 +21,9 @@ |
||
| 21 | 21 | */ |
| 22 | 22 | public function __invoke(ContainerInterface $container) |
| 23 | 23 | { |
| 24 | - $config = $container->has('config') ? $container->get('config') : []; |
|
| 25 | - $errorHandlerConfig = isset($config['error_handler']) ? $config['error_handler'] : []; |
|
| 26 | - $plugins = isset($errorHandlerConfig['plugins']) ? $errorHandlerConfig['plugins'] : []; |
|
| 24 | + $config = $container->has('config') ? $container->get('config') : [ ]; |
|
| 25 | + $errorHandlerConfig = isset($config[ 'error_handler' ]) ? $config[ 'error_handler' ] : [ ]; |
|
| 26 | + $plugins = isset($errorHandlerConfig[ 'plugins' ]) ? $errorHandlerConfig[ 'plugins' ] : [ ]; |
|
| 27 | 27 | return new ErrorHandlerManager($container, $plugins); |
| 28 | 28 | } |
| 29 | 29 | } |
@@ -68,7 +68,7 @@ |
||
| 68 | 68 | $accepts = $request->hasHeader('Accept') ? $request->getHeaderLine('Accept') : self::DEFAULT_CONTENT; |
| 69 | 69 | $accepts = explode(',', $accepts); |
| 70 | 70 | foreach ($accepts as $accept) { |
| 71 | - if (! $this->errorHandlerManager->has($accept)) { |
|
| 71 | + if (!$this->errorHandlerManager->has($accept)) { |
|
| 72 | 72 | continue; |
| 73 | 73 | } |
| 74 | 74 | |
@@ -17,10 +17,10 @@ |
||
| 17 | 17 | public function buildMessage(Request $request, Response $response, $err = null) |
| 18 | 18 | { |
| 19 | 19 | $base = 'Error occurred while dispatching request'; |
| 20 | - if (! isset($err)) { |
|
| 20 | + if (!isset($err)) { |
|
| 21 | 21 | return $base; |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - return $base . ': ' . PHP_EOL . $err; |
|
| 24 | + return $base.': '.PHP_EOL.$err; |
|
| 25 | 25 | } |
| 26 | 26 | } |
@@ -23,13 +23,13 @@ |
||
| 23 | 23 | */ |
| 24 | 24 | public function serviceIsCreated() |
| 25 | 25 | { |
| 26 | - $instance = $this->factory->__invoke(new ServiceManager(['services' => [ |
|
| 26 | + $instance = $this->factory->__invoke(new ServiceManager([ 'services' => [ |
|
| 27 | 27 | 'config' => [ |
| 28 | 28 | 'error_handler' => [ |
| 29 | - 'plugins' => [], |
|
| 29 | + 'plugins' => [ ], |
|
| 30 | 30 | ], |
| 31 | 31 | ], |
| 32 | - ]])); |
|
| 32 | + ] ])); |
|
| 33 | 33 | $this->assertInstanceOf(ErrorHandlerManager::class, $instance); |
| 34 | 34 | } |
| 35 | 35 | } |
@@ -26,17 +26,17 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | public function serviceIsCreated() |
| 28 | 28 | { |
| 29 | - $instance = $this->factory->__invoke(new ServiceManager(['services' => [ |
|
| 29 | + $instance = $this->factory->__invoke(new ServiceManager([ 'services' => [ |
|
| 30 | 30 | ErrorHandlerManager::class => $this->prophesize(ErrorHandlerManager::class)->reveal(), |
| 31 | 31 | LogMessageBuilderInterface::class => $this->prophesize(LogMessageBuilderInterface::class)->reveal(), |
| 32 | - ]])); |
|
| 32 | + ] ])); |
|
| 33 | 33 | $this->assertInstanceOf(ContentBasedErrorHandler::class, $instance); |
| 34 | 34 | |
| 35 | - $instance = $this->factory->__invoke(new ServiceManager(['services' => [ |
|
| 35 | + $instance = $this->factory->__invoke(new ServiceManager([ 'services' => [ |
|
| 36 | 36 | ErrorHandlerManager::class => $this->prophesize(ErrorHandlerManager::class)->reveal(), |
| 37 | 37 | LogMessageBuilderInterface::class => $this->prophesize(LogMessageBuilderInterface::class)->reveal(), |
| 38 | 38 | LoggerInterface::class => $this->prophesize(LoggerInterface::class)->reveal(), |
| 39 | - ]])); |
|
| 39 | + ] ])); |
|
| 40 | 40 | $this->assertInstanceOf(ContentBasedErrorHandler::class, $instance); |
| 41 | 41 | } |
| 42 | 42 | } |
@@ -21,15 +21,15 @@ discard block |
||
| 21 | 21 | { |
| 22 | 22 | $this->errorHandler = new ContentBasedErrorHandler(new ErrorHandlerManager(new ServiceManager(), [ |
| 23 | 23 | 'factories' => [ |
| 24 | - 'text/html' => [$this, 'factory'], |
|
| 25 | - 'application/json' => [$this, 'factory'], |
|
| 24 | + 'text/html' => [ $this, 'factory' ], |
|
| 25 | + 'application/json' => [ $this, 'factory' ], |
|
| 26 | 26 | ], |
| 27 | 27 | ]), new NullLogger(), new BasicLogMessageBuilder()); |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | public function factory($container, $name) |
| 31 | 31 | { |
| 32 | - return function () use ($name) { |
|
| 32 | + return function() use ($name) { |
|
| 33 | 33 | return $name; |
| 34 | 34 | }; |
| 35 | 35 | } |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | public function ifNoErrorHandlerIsFoundAnExceptionIsThrown() |
| 72 | 72 | { |
| 73 | 73 | $this->errorHandler = new ContentBasedErrorHandler( |
| 74 | - new ErrorHandlerManager(new ServiceManager(), []), |
|
| 74 | + new ErrorHandlerManager(new ServiceManager(), [ ]), |
|
| 75 | 75 | new NullLogger(), |
| 76 | 76 | new BasicLogMessageBuilder() |
| 77 | 77 | ); |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | { |
| 17 | 17 | $this->pluginManager = new ErrorHandlerManager(new ServiceManager(), [ |
| 18 | 18 | 'services' => [ |
| 19 | - 'foo' => function () { |
|
| 19 | + 'foo' => function() { |
|
| 20 | 20 | }, |
| 21 | 21 | ], |
| 22 | 22 | 'invokables' => [ |
@@ -34,6 +34,6 @@ |
||
| 34 | 34 | { |
| 35 | 35 | $err = 'A super critical error'; |
| 36 | 36 | $message = $this->messageBuilder->buildMessage(ServerRequestFactory::fromGlobals(), new Response(), $err); |
| 37 | - $this->assertEquals('Error occurred while dispatching request: ' . PHP_EOL . $err, $message); |
|
| 37 | + $this->assertEquals('Error occurred while dispatching request: '.PHP_EOL.$err, $message); |
|
| 38 | 38 | } |
| 39 | 39 | } |