Passed
Push — master ( 2006ec...f7310b )
by Michael
03:34
created
src/DependencyInjection/JsonApiExtension.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -50,16 +50,16 @@  discard block
 block discarded – undo
50 50
 
51 51
         $this->handleMappingDefinitionProvider($container);
52 52
 
53
-        if (! empty($config['mappers'])) {
54
-            $this->createMappers($config['mappers'], $container);
53
+        if (!empty($config[ 'mappers' ])) {
54
+            $this->createMappers($config[ 'mappers' ], $container);
55 55
         }
56 56
 
57
-        if (! empty($config['resource_clients'])) {
58
-            $this->createResourceClients($config['resource_clients'], $container);
57
+        if (!empty($config[ 'resource_clients' ])) {
58
+            $this->createResourceClients($config[ 'resource_clients' ], $container);
59 59
         }
60 60
 
61
-        if (! empty($config['http_client'])) {
62
-            $this->processHttpClient($config['http_client'], $container);
61
+        if (!empty($config[ 'http_client' ])) {
62
+            $this->processHttpClient($config[ 'http_client' ], $container);
63 63
         }
64 64
     }
65 65
 
@@ -71,17 +71,17 @@  discard block
 block discarded – undo
71 71
      */
72 72
     protected function processHttpClient(array $config, ContainerBuilder $container)
73 73
     {
74
-        if (empty($config['guzzle_service'])) {
74
+        if (empty($config[ 'guzzle_service' ])) {
75 75
             return;
76 76
         }
77 77
 
78
-        if ($container->hasDefinition($config['guzzle_service'])) {
78
+        if ($container->hasDefinition($config[ 'guzzle_service' ])) {
79 79
             throw new \LogicException(sprintf('Service "%s" has not been defined.'));
80 80
         }
81 81
 
82 82
         $container->getDefinition('mrtn_json_api.http_client.adapter.guzzle')
83 83
             ->setArguments([
84
-                new Reference($config['guzzle_service'])
84
+                new Reference($config[ 'guzzle_service' ])
85 85
             ]);
86 86
     }
87 87
 
@@ -122,16 +122,16 @@  discard block
 block discarded – undo
122 122
         foreach ($config as $name => $mapperDefinition)
123 123
         {
124 124
             $mapper = new DefinitionDecorator('mrtn_json_api.object_mapper.abstract');
125
-            $mapper->addTag('mrtn_json_api.object_mapper', ['alias' => $name]);
125
+            $mapper->addTag('mrtn_json_api.object_mapper', [ 'alias' => $name ]);
126 126
 
127
-            foreach ($mapperDefinition['handlers'] as $handlerName)
127
+            foreach ($mapperDefinition[ 'handlers' ] as $handlerName)
128 128
             {
129
-                if (! isset($handlers[$handlerName])) {
129
+                if (!isset($handlers[ $handlerName ])) {
130 130
                     throw new \LogicException(sprintf('Mapping handler with name "%s" has not been registered as a service.', $handlerName));
131 131
                 }
132 132
 
133 133
                 $mapper->addMethodCall('addHandler', [
134
-                    new Reference($handlers[$handlerName])
134
+                    new Reference($handlers[ $handlerName ])
135 135
                 ]);
136 136
             }
137 137
 
@@ -149,17 +149,17 @@  discard block
 block discarded – undo
149 149
     {
150 150
         $handlers = $container->findTaggedServiceIds('mrtn_json_api.object_mapper.handler');
151 151
 
152
-        $found = [];
152
+        $found = [ ];
153 153
 
154 154
         foreach ($handlers as $id => $tags)
155 155
         {
156 156
             foreach ($tags as $tag)
157 157
             {
158
-                if (! isset($tag['alias'])) {
158
+                if (!isset($tag[ 'alias' ])) {
159 159
                     continue;
160 160
                 }
161 161
 
162
-                $found[$tag['alias']] = $id;
162
+                $found[ $tag[ 'alias' ] ] = $id;
163 163
             }
164 164
         }
165 165
 
@@ -181,9 +181,9 @@  discard block
 block discarded – undo
181 181
         {
182 182
             $this->createEventDispatcherDecorator($container, $name);
183 183
 
184
-            $routes = $this->createRoutesDefinition($definition['resources']);
184
+            $routes = $this->createRoutesDefinition($definition[ 'resources' ]);
185 185
 
186
-            $repository = new Definition($repositoryClass, [$definition['base_url'], $routes]);
186
+            $repository = new Definition($repositoryClass, [ $definition[ 'base_url' ], $routes ]);
187 187
             $repository->setPublic(false);
188 188
 
189 189
             $client = new Definition($clientClass, [
@@ -227,15 +227,15 @@  discard block
 block discarded – undo
227 227
      */
228 228
     protected function createRoutesDefinition(array $resources): array
229 229
     {
230
-        $definition = [];
230
+        $definition = [ ];
231 231
 
232 232
         foreach ($resources as $name => $resource)
233 233
         {
234
-            $methods = array_keys($resource['methods']);
234
+            $methods = array_keys($resource[ 'methods' ]);
235 235
             $methods = array_map('strtoupper', $methods);
236 236
 
237
-            $definition[$name] = [
238
-                'path'    => trim($resource['path']),
237
+            $definition[ $name ] = [
238
+                'path'    => trim($resource[ 'path' ]),
239 239
                 'methods' => array_map('trim', $methods)
240 240
             ];
241 241
         }
Please login to merge, or discard this patch.