@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | namespace Acelaya\ExpressiveErrorHandler\ErrorHandler\Factory; |
5 | 5 | |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | */ |
24 | 24 | public function __invoke(ContainerInterface $container) |
25 | 25 | { |
26 | - $config = $container->has('config') ? $container->get('config') : []; |
|
27 | - return new ErrorResponseGenerator(isset($config['debug']) ? (bool) $config['debug'] : false); |
|
26 | + $config = $container->has('config') ? $container->get('config') : [ ]; |
|
27 | + return new ErrorResponseGenerator(isset($config[ 'debug' ]) ? (bool) $config[ 'debug' ] : false); |
|
28 | 28 | } |
29 | 29 | } |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | */ |
26 | 26 | public function __invoke(ContainerInterface $container) |
27 | 27 | { |
28 | - $config = $container->has('config') ? $container->get('config') : []; |
|
29 | - $ehConfig = isset($config['error_handler']) ? $config['error_handler'] : []; |
|
28 | + $config = $container->has('config') ? $container->get('config') : [ ]; |
|
29 | + $ehConfig = isset($config[ 'error_handler' ]) ? $config[ 'error_handler' ] : [ ]; |
|
30 | 30 | |
31 | 31 | $errorHandlerManager = $container->get(ErrorResponseGeneratorManager::class); |
32 | 32 | $logger = $container->has(LoggerInterface::class) ? $container->get(LoggerInterface::class) : new NullLogger(); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $errorHandlerManager, |
37 | 37 | $logger, |
38 | 38 | $logMessageBuilder, |
39 | - isset($ehConfig['default_content_type']) ? $ehConfig['default_content_type'] : 'text/html' |
|
39 | + isset($ehConfig[ 'default_content_type' ]) ? $ehConfig[ 'default_content_type' ] : 'text/html' |
|
40 | 40 | ); |
41 | 41 | } |
42 | 42 | } |
@@ -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 ErrorResponseGeneratorManager($container, $plugins); |
28 | 28 | } |
29 | 29 | } |
@@ -80,7 +80,7 @@ |
||
80 | 80 | /** @var array $accepts */ |
81 | 81 | $accepts = explode(',', $accepts); |
82 | 82 | foreach ($accepts as $accept) { |
83 | - if (! $this->errorHandlerManager->has($accept)) { |
|
83 | + if (!$this->errorHandlerManager->has($accept)) { |
|
84 | 84 | continue; |
85 | 85 | } |
86 | 86 |
@@ -16,7 +16,7 @@ |
||
16 | 16 | { |
17 | 17 | $this->pluginManager = new ErrorResponseGeneratorManager(new ServiceManager(), [ |
18 | 18 | 'services' => [ |
19 | - 'foo' => function () { |
|
19 | + 'foo' => function() { |
|
20 | 20 | }, |
21 | 21 | ], |
22 | 22 | 'invokables' => [ |
@@ -26,17 +26,17 @@ discard block |
||
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 | ErrorResponseGeneratorManager::class => $this->prophesize(ErrorResponseGeneratorManager::class)->reveal(), |
31 | 31 | LogMessageBuilderInterface::class => $this->prophesize(LogMessageBuilderInterface::class)->reveal(), |
32 | - ]])); |
|
32 | + ] ])); |
|
33 | 33 | $this->assertInstanceOf(ContentBasedErrorResponseGenerator::class, $instance); |
34 | 34 | |
35 | - $instance = $this->factory->__invoke(new ServiceManager(['services' => [ |
|
35 | + $instance = $this->factory->__invoke(new ServiceManager([ 'services' => [ |
|
36 | 36 | ErrorResponseGeneratorManager::class => $this->prophesize(ErrorResponseGeneratorManager::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(ContentBasedErrorResponseGenerator::class, $instance); |
41 | 41 | } |
42 | 42 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | public function defaultContentTypeIsSetWhenDefined() |
47 | 47 | { |
48 | 48 | /** @var ContentBasedErrorResponseGenerator $instance */ |
49 | - $instance = $this->factory->__invoke(new ServiceManager(['services' => [ |
|
49 | + $instance = $this->factory->__invoke(new ServiceManager([ 'services' => [ |
|
50 | 50 | ErrorResponseGeneratorManager::class => $this->prophesize(ErrorResponseGeneratorManager::class)->reveal(), |
51 | 51 | LogMessageBuilderInterface::class => $this->prophesize(LogMessageBuilderInterface::class)->reveal(), |
52 | 52 | 'config' => [ |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | 'default_content_type' => 'application/json', |
55 | 55 | ], |
56 | 56 | ], |
57 | - ]])); |
|
57 | + ] ])); |
|
58 | 58 | |
59 | 59 | $ref = new \ReflectionObject($instance); |
60 | 60 | $prop = $ref->getProperty('defaultContentType'); |
@@ -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(ErrorResponseGeneratorManager::class, $instance); |
34 | 34 | } |
35 | 35 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | namespace AcelayaTest\ExpressiveErrorHandler\ErrorHandler\Factory; |
5 | 5 | |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | */ |
26 | 26 | public function serviceIsCreated() |
27 | 27 | { |
28 | - $instance = $this->factory->__invoke(new ServiceManager([])); |
|
28 | + $instance = $this->factory->__invoke(new ServiceManager([ ])); |
|
29 | 29 | $this->assertInstanceOf(ErrorResponseGenerator::class, $instance); |
30 | 30 | } |
31 | 31 | } |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | $this->errorHandler = new ContentBasedErrorResponseGenerator( |
23 | 23 | new ErrorResponseGeneratorManager(new ServiceManager(), [ |
24 | 24 | 'factories' => [ |
25 | - 'text/html' => [$this, 'factory'], |
|
26 | - 'application/json' => [$this, 'factory'], |
|
25 | + 'text/html' => [ $this, 'factory' ], |
|
26 | + 'application/json' => [ $this, 'factory' ], |
|
27 | 27 | ], |
28 | 28 | ]), |
29 | 29 | new NullLogger(), |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | |
34 | 34 | public function factory($container, $name) |
35 | 35 | { |
36 | - return function () use ($name) { |
|
36 | + return function() use ($name) { |
|
37 | 37 | return $name; |
38 | 38 | }; |
39 | 39 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | public function ifNoErrorHandlerIsFoundAnExceptionIsThrown() |
76 | 76 | { |
77 | 77 | $this->errorHandler = new ContentBasedErrorResponseGenerator( |
78 | - new ErrorResponseGeneratorManager(new ServiceManager(), []), |
|
78 | + new ErrorResponseGeneratorManager(new ServiceManager(), [ ]), |
|
79 | 79 | new NullLogger(), |
80 | 80 | new BasicLogMessageBuilder() |
81 | 81 | ); |
@@ -91,8 +91,8 @@ discard block |
||
91 | 91 | $this->errorHandler = new ContentBasedErrorResponseGenerator( |
92 | 92 | new ErrorResponseGeneratorManager(new ServiceManager(), [ |
93 | 93 | 'factories' => [ |
94 | - 'text/html' => [$this, 'factory'], |
|
95 | - 'application/json' => [$this, 'factory'], |
|
94 | + 'text/html' => [ $this, 'factory' ], |
|
95 | + 'application/json' => [ $this, 'factory' ], |
|
96 | 96 | ], |
97 | 97 | ]), |
98 | 98 | new NullLogger(), |