Completed
Push — master ( 5d9a92...ab5aec )
by Raffael
01:46
created
src/Config/Struct.php 2 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -60,7 +60,6 @@
 block discarded – undo
60 60
     /**
61 61
      * map Array
62 62
      *
63
-     * @param   array $config
64 63
      * @return  Config
65 64
      */
66 65
     protected function mapArray(array $array): Config
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,8 +66,8 @@
 block discarded – undo
66 66
     protected function mapArray(array $array): Config
67 67
     {
68 68
         $config = new Config();
69
-        foreach($array as $key => $value) {
70
-            if(is_array($value)) {
69
+        foreach ($array as $key => $value) {
70
+            if (is_array($value)) {
71 71
                 $config[$key] = $this->mapArray($value);
72 72
             } else {
73 73
                 $config[$key] = $value;
Please login to merge, or discard this patch.
src/Ldap.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@
 block discarded – undo
84 84
      * construct
85 85
      *
86 86
      * @param   Iterable $config
87
-     * @param   Logger $logger
87
+     * @param   LoggerInterface $logger
88 88
      * @return  resource
89 89
      */
90 90
     public function __construct(LoggerInterface $logger, ?Iterable $config=null)
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@
 block discarded – undo
87 87
      * @param   Logger $logger
88 88
      * @return  resource
89 89
      */
90
-    public function __construct(LoggerInterface $logger, ?Iterable $config=null)
90
+    public function __construct(LoggerInterface $logger, ?Iterable $config = null)
91 91
     {
92 92
         $this->setOptions($config);
93 93
         $this->logger = $logger;
Please login to merge, or discard this patch.
src/Config.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
      * @param   string $config
43 43
      * @return  void
44 44
      */
45
-    public function __construct(?ConfigInterface $config=null)
45
+    public function __construct(?ConfigInterface $config = null)
46 46
     {
47
-        if($config !== null) {
47
+        if ($config !== null) {
48 48
             $this->_store = $config->map()->children();
49 49
         }
50 50
     }
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
      */
70 70
     public function merge(Config $from): Config
71 71
     {
72
-        foreach($from as $key => $value) {
73
-            if(isset($this->_store[$key]) && $this->_store[$key] instanceof Config) {
72
+        foreach ($from as $key => $value) {
73
+            if (isset($this->_store[$key]) && $this->_store[$key] instanceof Config) {
74 74
                 $this->_store[$key]->merge($value);
75 75
             } else {
76 76
                 $this->_store[$key] = $value;
Please login to merge, or discard this patch.
src/Container.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -191,7 +191,7 @@
 block discarded – undo
191 191
                     }
192 192
 
193 193
                     $args[$param_name] = $this->findParentService($name, $type_class, $config, $parents);
194
-               }
194
+                }
195 195
             }
196 196
 
197 197
             return $this->createInstance($name, $reflection, $args, $config, $parents);
Please login to merge, or discard this patch.
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      *
49 49
      * @param array $config
50 50
      */
51
-    public function __construct(Iterable $config=[])
51
+    public function __construct(Iterable $config = [])
52 52
     {
53 53
         $this->config = $config;
54 54
         $container = $this;
@@ -66,10 +66,10 @@  discard block
 block discarded – undo
66 66
      */
67 67
     public function get($name)
68 68
     {
69
-        if($this->has($name)) {
69
+        if ($this->has($name)) {
70 70
             return $this->service[$name]['instance'];
71 71
         } else {
72
-            if(isset($this->registry[$name])) {
72
+            if (isset($this->registry[$name])) {
73 73
                 $this->service[$name]['instance'] = $this->registry[$name]->call($this);
74 74
                 unset($this->registry[$name]);
75 75
                 return $this->service[$name]['instance'];
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
      */
89 89
     public function getNew(string $name)
90 90
     {
91
-        if(isset($this->registry[$name])) {
91
+        if (isset($this->registry[$name])) {
92 92
             return $this->registry[$name]->call($this);
93 93
         } else {
94 94
             return $this->autoWire($name);
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
      */
106 106
     public function add(string $name, Closure $service): Container
107 107
     {
108
-        if($this->has($name)) {
108
+        if ($this->has($name)) {
109 109
             throw new Exception('service '.$name.' is already registered');
110 110
         }
111 111
 
@@ -133,18 +133,18 @@  discard block
 block discarded – undo
133 133
      * @param array $parents
134 134
      * @return mixed
135 135
      */
136
-    protected function autoWire(string $name, $config=null, array $parents=[])
136
+    protected function autoWire(string $name, $config = null, array $parents = [])
137 137
     {
138
-        if($config === null) {
138
+        if ($config === null) {
139 139
             $config = $this->config;
140 140
         }
141 141
 
142 142
         $class = $name;
143 143
         $sub_config = $config;
144
-        if(isset($config[$name])) {
145
-            if(isset($config[$name]['use'])) {
144
+        if (isset($config[$name])) {
145
+            if (isset($config[$name]['use'])) {
146 146
                 $class = $config[$name]['use'];
147
-            } elseif(isset($config[$name]['name'])) {
147
+            } elseif (isset($config[$name]['name'])) {
148 148
                 $class = $config[$name]['name'];
149 149
             }
150 150
 
@@ -155,29 +155,29 @@  discard block
 block discarded – undo
155 155
 
156 156
         try {
157 157
             $reflection = new ReflectionClass($class);
158
-        } catch(\Exception $e) {
158
+        } catch (\Exception $e) {
159 159
             throw new Exception($class.' can not be resolved to an existing class');
160 160
         }
161 161
 
162 162
         $constructor = $reflection->getConstructor();
163 163
 
164
-        if($constructor === null) {
164
+        if ($constructor === null) {
165 165
             return new $class();
166 166
         } else {
167 167
             $params = $constructor->getParameters();
168 168
             $args = [];
169 169
 
170
-            foreach($params as $param) {
170
+            foreach ($params as $param) {
171 171
                 $type = $param->getClass();
172 172
                 $param_name = $param->getName();
173 173
 
174
-                if($type === null) {
174
+                if ($type === null) {
175 175
                     try {
176 176
                         $args[$param_name] = $this->getParam($name, $param_name, $sub_config);
177
-                    } catch(Exception $e) {
178
-                        if($param->isDefaultValueAvailable()) {
177
+                    } catch (Exception $e) {
178
+                        if ($param->isDefaultValueAvailable()) {
179 179
                             $args[$param_name] = $param->getDefaultValue();
180
-                        } elseif($param->allowsNull()) {
180
+                        } elseif ($param->allowsNull()) {
181 181
                             $args[$param_name] = null;
182 182
                         } else {
183 183
                             throw $e;
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
                 } else {
187 187
                     $type_class = $type->getName();
188 188
 
189
-                    if($type_class === $name) {
189
+                    if ($type_class === $name) {
190 190
                         throw new Exception('class '.$type_class.' can not depend on itself');
191 191
                     }
192 192
 
@@ -210,10 +210,10 @@  discard block
 block discarded – undo
210 210
     {
211 211
         $service = null;
212 212
         $services = $this->service;
213
-        foreach(array_reverse($parents) as $name => $parent) {
214
-            if(isset($services[$name])) {
213
+        foreach (array_reverse($parents) as $name => $parent) {
214
+            if (isset($services[$name])) {
215 215
                 $service = $services[$name];
216
-                if(isset($services['service'])) {
216
+                if (isset($services['service'])) {
217 217
                     $services = $services['service']; }
218 218
                 else {
219 219
                     break;
@@ -223,12 +223,12 @@  discard block
 block discarded – undo
223 223
             }
224 224
         }
225 225
 
226
-        if($service !== null) {
226
+        if ($service !== null) {
227 227
             return $service['instance'];
228 228
         }
229 229
 
230
-        foreach(array_reverse($parents) as $parent) {
231
-            if(isset($parent['service'][$class])) {
230
+        foreach (array_reverse($parents) as $parent) {
231
+            if (isset($parent['service'][$class])) {
232 232
                 return $this->autoWire($class, $parent['service'], $parents);
233 233
             }
234 234
         }
@@ -245,17 +245,17 @@  discard block
 block discarded – undo
245 245
      * @param  array $args
246 246
      * @return mixed
247 247
      */
248
-    protected function createInstance(string $name, ReflectionClass $class, array $args, Iterable $config, $parents=[])
248
+    protected function createInstance(string $name, ReflectionClass $class, array $args, Iterable $config, $parents = [])
249 249
     {
250 250
         $instance = $class->newInstanceArgs($args);
251 251
 
252 252
         $loop = &$this->service;
253
-        foreach($parents as $p => $parent) {
253
+        foreach ($parents as $p => $parent) {
254 254
             $loop = &$loop[$p];
255 255
         }
256
-        if(count($parents) === 0) {
256
+        if (count($parents) === 0) {
257 257
             $loop[$name]['instance'] = $instance;
258
-        }   else {
258
+        } else {
259 259
             $loop['service'][$name]['instance'] = $instance;
260 260
         }
261 261
 
@@ -265,10 +265,10 @@  discard block
 block discarded – undo
265 265
 
266 266
         array_unshift($parents, $name);
267 267
 
268
-        if($instance instanceof AdapterAwareInterface) {
269
-            if(isset($config['adapter'])) {
270
-                foreach($config['adapter'] as $adapter => $service) {
271
-                    if(isset($service['enabled']) && $service['enabled'] === '0') {
268
+        if ($instance instanceof AdapterAwareInterface) {
269
+            if (isset($config['adapter'])) {
270
+                foreach ($config['adapter'] as $adapter => $service) {
271
+                    if (isset($service['enabled']) && $service['enabled'] === '0') {
272 272
                         continue;
273 273
                     }
274 274
 
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
                     $class = $adapter;
278 278
                     $adapter_instance = $this->autoWire($class, $config['adapter'], $parents);
279 279
 
280
-                    if(isset($service['expose']) && $service['expose']) {
280
+                    if (isset($service['expose']) && $service['expose']) {
281 281
                         $this->service[$adapter]['instance'] = $adapter_instance;
282 282
                     }
283 283
 
@@ -297,13 +297,13 @@  discard block
 block discarded – undo
297 297
      * @param  string $param
298 298
      * @return mixed
299 299
      */
300
-    public function getParam(string $name, string $param, ?Iterable $config=null)
300
+    public function getParam(string $name, string $param, ?Iterable $config = null)
301 301
     {
302
-        if($config === null) {
302
+        if ($config === null) {
303 303
             $config = $this->config;
304 304
         }
305 305
 
306
-        if(!isset($config[$name]['options'][$param])) {
306
+        if (!isset($config[$name]['options'][$param])) {
307 307
             throw new Exception('no configuration available for required service parameter '.$param);
308 308
         }
309 309
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -214,8 +214,7 @@  discard block
 block discarded – undo
214 214
             if(isset($services[$name])) {
215 215
                 $service = $services[$name];
216 216
                 if(isset($services['service'])) {
217
-                    $services = $services['service']; }
218
-                else {
217
+                    $services = $services['service']; } else {
219 218
                     break;
220 219
                 }
221 220
             } else {
@@ -255,7 +254,7 @@  discard block
 block discarded – undo
255 254
         }
256 255
         if(count($parents) === 0) {
257 256
             $loop[$name]['instance'] = $instance;
258
-        }   else {
257
+        } else {
259 258
             $loop['service'][$name]['instance'] = $instance;
260 259
         }
261 260
 
Please login to merge, or discard this patch.
src/Log/Adapter/Syslog.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
      *
46 46
      * @return  AdapterInterface
47 47
      */
48
-    public function setOptions(? Iterable $config = null): AdapterInterface
48
+    public function setOptions(? Iterable $config = null) : AdapterInterface
49 49
     {
50 50
         if ($config === null) {
51 51
             return $this;
Please login to merge, or discard this patch.
src/Config/Xml.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
             if (count($simplexml_child->children()) === 0) {
120 120
                 if (!isset($simplexml_to->{$simplexml_child->getName()})) {
121 121
                     $simplexml_to->addChild($simplexml_child->getName(), htmlspecialchars((string)$simplexml_child));
122
-                } elseif(count($simplexml_to->{$simplexml_child->getName()}->children()) === 0) {
122
+                } elseif (count($simplexml_to->{$simplexml_child->getName()}->children()) === 0) {
123 123
                     $simplexml_to->{$simplexml_child->getName()} = htmlspecialchars((string)$simplexml_child);
124 124
                 }
125 125
             } else {
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
      * @param   SimpleXMLElement $xml
202 202
      * @return  Config
203 203
      */
204
-    public function map(?SimpleXMLElement $xml = null): Config
204
+    public function map(?SimpleXMLElement $xml = null) : Config
205 205
     {
206 206
         if ($xml === null) {
207 207
             $xml = $this->store;
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 
210 210
         $config = new Config();
211 211
         foreach ($xml->getNamespaces() + [null] as $prefix => $namespace) {
212
-            if($prefix === self::CONFIG_FEATURE_NAMESPACE_PREFIX) {
212
+            if ($prefix === self::CONFIG_FEATURE_NAMESPACE_PREFIX) {
213 213
                 continue;
214 214
             }
215 215
 
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
         }
228 228
 
229 229
         foreach ($xml as $name => $element) {
230
-            if(isset($element->attributes(self::CONFIG_FEATURE_NAMESPACE)->name)) {
230
+            if (isset($element->attributes(self::CONFIG_FEATURE_NAMESPACE)->name)) {
231 231
                 $name = (string)$element->attributes(self::CONFIG_FEATURE_NAMESPACE)->name;
232 232
             }
233 233
 
Please login to merge, or discard this patch.
src/Auth/Adapter/Basic/Ldap.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
     protected $account_filter = '(uid=%s)';
44 44
 
45 45
 
46
-    public function __construct(LdapServer $ldap, LoggerInterface $logger, ?Iterable $config=null)
46
+    public function __construct(LdapServer $ldap, LoggerInterface $logger, ?Iterable $config = null)
47 47
     {
48 48
         $this->logger = $logger;
49 49
         $this->ldap = $ldap;
Please login to merge, or discard this patch.