Passed
Push — master ( d7bd96...cddd2f )
by Michael
06:38
created
src/DependencyInjection/JsonApiExtension.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -48,12 +48,12 @@  discard block
 block discarded – undo
48 48
         $loader->load('mapper.yml');
49 49
         $loader->load('http_client.yml');
50 50
 
51
-        if (! empty($config['mappers'])) {
52
-            $this->createMappers($config['mappers'], $container);
51
+        if (!empty($config[ 'mappers' ])) {
52
+            $this->createMappers($config[ 'mappers' ], $container);
53 53
         }
54 54
 
55
-        if (! empty($config['resource_clients'])) {
56
-            $this->createResourceClients($config['resource_clients'], $container);
55
+        if (!empty($config[ 'resource_clients' ])) {
56
+            $this->createResourceClients($config[ 'resource_clients' ], $container);
57 57
         }
58 58
     }
59 59
 
@@ -70,16 +70,16 @@  discard block
 block discarded – undo
70 70
         foreach ($config as $name => $mapperDefinition)
71 71
         {
72 72
             $mapper = new DefinitionDecorator('mrtn_json_api.object_mapper.abstract');
73
-            $mapper->addTag('mrtn_json_api.object_mapper', ['alias' => $name]);
73
+            $mapper->addTag('mrtn_json_api.object_mapper', [ 'alias' => $name ]);
74 74
 
75
-            foreach ($mapperDefinition['handlers'] as $handlerName)
75
+            foreach ($mapperDefinition[ 'handlers' ] as $handlerName)
76 76
             {
77
-                if (! isset($handlers[$handlerName])) {
77
+                if (!isset($handlers[ $handlerName ])) {
78 78
                     throw new \LogicException(sprintf('Mapping handler with name "%s" has not been registered as a service.', $handlerName));
79 79
                 }
80 80
 
81 81
                 $mapper->addMethodCall('addHandler', [
82
-                    new Reference($handlers[$handlerName])
82
+                    new Reference($handlers[ $handlerName ])
83 83
                 ]);
84 84
             }
85 85
 
@@ -97,17 +97,17 @@  discard block
 block discarded – undo
97 97
     {
98 98
         $handlers = $container->findTaggedServiceIds('mrtn_json_api.object_mapper.handler');
99 99
 
100
-        $found = [];
100
+        $found = [ ];
101 101
 
102 102
         foreach ($handlers as $id => $tags)
103 103
         {
104 104
             foreach ($tags as $tag)
105 105
             {
106
-                if (! isset($tag['alias'])) {
106
+                if (!isset($tag[ 'alias' ])) {
107 107
                     continue;
108 108
                 }
109 109
 
110
-                $found[$tag['alias']] = $id;
110
+                $found[ $tag[ 'alias' ] ] = $id;
111 111
             }
112 112
         }
113 113
 
@@ -129,9 +129,9 @@  discard block
 block discarded – undo
129 129
         {
130 130
             $this->createEventDispatcherDecorator($container, $name);
131 131
 
132
-            $routes = $this->createRoutesDefinition($definition['resources']);
132
+            $routes = $this->createRoutesDefinition($definition[ 'resources' ]);
133 133
 
134
-            $repository = new Definition($repositoryClass, [$definition['base_url'], $routes]);
134
+            $repository = new Definition($repositoryClass, [ $definition[ 'base_url' ], $routes ]);
135 135
             $repository->setPublic(false);
136 136
 
137 137
             $client = new Definition($clientClass, [
@@ -175,15 +175,15 @@  discard block
 block discarded – undo
175 175
      */
176 176
     protected function createRoutesDefinition(array $resources): array
177 177
     {
178
-        $definition = [];
178
+        $definition = [ ];
179 179
 
180 180
         foreach ($resources as $name => $resource)
181 181
         {
182
-            $methods = array_keys($resource['methods']);
182
+            $methods = array_keys($resource[ 'methods' ]);
183 183
             $methods = array_map('strtoupper', $methods);
184 184
 
185
-            $definition[$name] = [
186
-                'path'    => trim($resource['path']),
185
+            $definition[ $name ] = [
186
+                'path'    => trim($resource[ 'path' ]),
187 187
                 'methods' => array_map('trim', $methods)
188 188
             ];
189 189
         }
Please login to merge, or discard this patch.