Completed
Pull Request — master (#17)
by Alejandro
05:53
created
src/ErrorHandler/ContentBasedErrorResponseGenerator.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
test/ErrorHandler/ErrorHandlerManagerTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
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' => [
Please login to merge, or discard this patch.
src/ErrorHandler/Factory/PlainTextResponseGeneratorFactory.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/ErrorHandler/Factory/ContentBasedErrorResponseGeneratorFactory.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,8 +27,8 @@  discard block
 block discarded – undo
27 27
      */
28 28
     public function __invoke(ContainerInterface $container)
29 29
     {
30
-        $config = $container->has('config') ? $container->get('config') : [];
31
-        $ehConfig = $config['error_handler'] ?? [];
30
+        $config = $container->has('config') ? $container->get('config') : [ ];
31
+        $ehConfig = $config[ 'error_handler' ] ?? [ ];
32 32
 
33 33
         $errorHandlerManager = $container->get(ErrorResponseGeneratorManager::class);
34 34
         $logger = $container->has(LoggerInterface::class) ? $container->get(LoggerInterface::class) : new NullLogger();
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
             $errorHandlerManager,
39 39
             $logger,
40 40
             $logMessageBuilder,
41
-            $ehConfig['default_content_type'] ?? 'text/html'
41
+            $ehConfig[ 'default_content_type' ] ?? 'text/html'
42 42
         );
43 43
     }
44 44
 }
Please login to merge, or discard this patch.
src/ErrorHandler/Factory/ErrorHandlerManagerFactory.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,8 +23,8 @@
 block discarded – undo
23 23
      */
24 24
     public function __invoke(ContainerInterface $container)
25 25
     {
26
-        $config = $container->has('config') ? $container->get('config') : [];
27
-        $plugins = $config['error_handler']['plugins'] ?? [];
26
+        $config = $container->has('config') ? $container->get('config') : [ ];
27
+        $plugins = $config[ 'error_handler' ][ 'plugins' ] ?? [ ];
28 28
         return new ErrorResponseGeneratorManager($container, $plugins);
29 29
     }
30 30
 }
Please login to merge, or discard this patch.
test/ErrorHandler/Factory/PlainTextResponseGeneratorFactoryTest.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -25,9 +25,9 @@  discard block
 block discarded – undo
25 25
      */
26 26
     public function serviceIsCreated(array $config, bool $expectedIsDev): void
27 27
     {
28
-        $instance = $this->factory->__invoke(new ServiceManager(['services' => [
28
+        $instance = $this->factory->__invoke(new ServiceManager([ 'services' => [
29 29
             'config' => $config,
30
-        ]]));
30
+        ] ]));
31 31
 
32 32
         $ref = new ReflectionObject($instance);
33 33
         $isDev = $ref->getProperty('isDevelopmentMode');
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
 
40 40
     public function provideDebugs(): iterable
41 41
     {
42
-        yield [[], false];
43
-        yield [['debug' => true], true];
44
-        yield [['debug' => false], false];
42
+        yield [ [ ], false ];
43
+        yield [ [ 'debug' => true ], true ];
44
+        yield [ [ 'debug' => false ], false ];
45 45
     }
46 46
 }
Please login to merge, or discard this patch.
test/ErrorHandler/Factory/ErrorHandlerManagerFactoryTest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,13 +23,13 @@
 block discarded – undo
23 23
      */
24 24
     public function serviceIsCreated(): void
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
 }
Please login to merge, or discard this patch.
test/ErrorHandler/Factory/ContentBasedErrorHandlerFactoryTest.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -27,17 +27,17 @@  discard block
 block discarded – undo
27 27
      */
28 28
     public function serviceIsCreated(): void
29 29
     {
30
-        $instance = $this->factory->__invoke(new ServiceManager(['services' => [
30
+        $instance = $this->factory->__invoke(new ServiceManager([ 'services' => [
31 31
             ErrorResponseGeneratorManager::class => $this->prophesize(ErrorResponseGeneratorManager::class)->reveal(),
32 32
             LogMessageBuilderInterface::class => $this->prophesize(LogMessageBuilderInterface::class)->reveal(),
33
-        ]]));
33
+        ] ]));
34 34
         $this->assertInstanceOf(ContentBasedErrorResponseGenerator::class, $instance);
35 35
 
36
-        $instance = $this->factory->__invoke(new ServiceManager(['services' => [
36
+        $instance = $this->factory->__invoke(new ServiceManager([ 'services' => [
37 37
             ErrorResponseGeneratorManager::class => $this->prophesize(ErrorResponseGeneratorManager::class)->reveal(),
38 38
             LogMessageBuilderInterface::class => $this->prophesize(LogMessageBuilderInterface::class)->reveal(),
39 39
             LoggerInterface::class => $this->prophesize(LoggerInterface::class)->reveal(),
40
-        ]]));
40
+        ] ]));
41 41
         $this->assertInstanceOf(ContentBasedErrorResponseGenerator::class, $instance);
42 42
     }
43 43
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
     public function defaultContentTypeIsSetWhenDefined(): void
48 48
     {
49 49
         /** @var ContentBasedErrorResponseGenerator $instance */
50
-        $instance = $this->factory->__invoke(new ServiceManager(['services' => [
50
+        $instance = $this->factory->__invoke(new ServiceManager([ 'services' => [
51 51
             ErrorResponseGeneratorManager::class => $this->prophesize(ErrorResponseGeneratorManager::class)->reveal(),
52 52
             LogMessageBuilderInterface::class => $this->prophesize(LogMessageBuilderInterface::class)->reveal(),
53 53
             'config' => [
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
                     'default_content_type' => 'application/json',
56 56
                 ],
57 57
             ],
58
-        ]]));
58
+        ] ]));
59 59
 
60 60
         $ref = new ReflectionObject($instance);
61 61
         $prop = $ref->getProperty('defaultContentType');
Please login to merge, or discard this patch.
test/ErrorHandler/ContentBasedErrorHandlerTest.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -23,8 +23,8 @@  discard block
 block discarded – undo
23 23
         $this->errorHandler = new ContentBasedErrorResponseGenerator(
24 24
             new ErrorResponseGeneratorManager(new ServiceManager(), [
25 25
                 'factories' => [
26
-                    'text/html' => [$this, 'factory'],
27
-                    'application/json' => [$this, 'factory'],
26
+                    'text/html' => [ $this, 'factory' ],
27
+                    'application/json' => [ $this, 'factory' ],
28 28
                 ],
29 29
             ]),
30 30
             new NullLogger(),
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 
35 35
     public function factory($container, $name): callable
36 36
     {
37
-        return function () use ($name) {
37
+        return function() use ($name) {
38 38
             return (new Response())->withHeader('Content-type', $name);
39 39
         };
40 40
     }
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
     public function ifNoErrorHandlerIsFoundAnExceptionIsThrown(): void
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
         );
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
         $this->errorHandler = new ContentBasedErrorResponseGenerator(
94 94
             new ErrorResponseGeneratorManager(new ServiceManager(), [
95 95
                 'factories' => [
96
-                    'text/html' => [$this, 'factory'],
97
-                    'application/json' => [$this, 'factory'],
96
+                    'text/html' => [ $this, 'factory' ],
97
+                    'application/json' => [ $this, 'factory' ],
98 98
                 ],
99 99
             ]),
100 100
             new NullLogger(),
Please login to merge, or discard this patch.