Passed
Push — master ( 4e00f9...271a5a )
by Thierry
03:37
created
src/Di/Traits/RegisterTrait.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -36,15 +36,15 @@  discard block
 block discarded – undo
36 36
     private function getCallableObjectOptions(array $aConfigOptions, array $aAnnotationOptions): array
37 37
     {
38 38
         $aOptions = [];
39
-        foreach($aConfigOptions as $sNames => $aFunctionOptions)
39
+        foreach ($aConfigOptions as $sNames => $aFunctionOptions)
40 40
         {
41 41
             $aFunctionNames = explode(',', $sNames); // Names are in comma-separated list.
42
-            foreach($aFunctionNames as $sFunctionName)
42
+            foreach ($aFunctionNames as $sFunctionName)
43 43
             {
44 44
                 $aOptions[$sFunctionName] = array_merge($aOptions[$sFunctionName] ?? [], $aFunctionOptions);
45 45
             }
46 46
         }
47
-        foreach($aAnnotationOptions as $sFunctionName => $aFunctionOptions)
47
+        foreach ($aAnnotationOptions as $sFunctionName => $aFunctionOptions)
48 48
         {
49 49
             $aOptions[$sFunctionName] = array_merge($aOptions[$sFunctionName] ?? [], $aFunctionOptions);
50 50
         }
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         $aMethods = $xCallableObject->getPublicMethods($aProtectedMethods);
67 67
         $aProperties = $xCallableObject->getProperties();
68 68
         [$bExcluded, $aAnnotationOptions, $aAnnotationProtected] = $xAnnotationReader->getAttributes($sClassName, $aMethods, $aProperties);
69
-        if($bExcluded)
69
+        if ($bExcluded)
70 70
         {
71 71
             $xCallableObject->configure('excluded', true);
72 72
             return;
@@ -78,11 +78,11 @@  discard block
 block discarded – undo
78 78
         // Functions options
79 79
         $aCallableOptions = [];
80 80
         $aOptions = $this->getCallableObjectOptions($aOptions['functions'], $aAnnotationOptions);
81
-        foreach($aOptions as $sFunctionName => $aFunctionOptions)
81
+        foreach ($aOptions as $sFunctionName => $aFunctionOptions)
82 82
         {
83
-            foreach($aFunctionOptions as $sOptionName => $xOptionValue)
83
+            foreach ($aFunctionOptions as $sOptionName => $xOptionValue)
84 84
             {
85
-                if(substr($sOptionName, 0, 2) !== '__')
85
+                if (substr($sOptionName, 0, 2) !== '__')
86 86
                 {
87 87
                     // Options for javascript code.
88 88
                     $aCallableOptions[$sFunctionName][$sOptionName] = $xOptionValue;
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
         $sReflectionClass = $sClassName . '_ReflectionClass';
112 112
 
113 113
         // Make sure the registered class exists
114
-        if(isset($aOptions['include']))
114
+        if (isset($aOptions['include']))
115 115
         {
116 116
             require_once($aOptions['include']);
117 117
         }
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
         {
121 121
             $this->val($sReflectionClass, new ReflectionClass($sClassName));
122 122
         }
123
-        catch(ReflectionException $e)
123
+        catch (ReflectionException $e)
124 124
         {
125 125
             $xTranslator = $this->g(Translator::class);
126 126
             $sMessage = $xTranslator->trans('errors.class.invalid', ['name' => $sClassName]);
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
         $this->set($sClassName, function($c) use($sClassName, $sReflectionClass) {
147 147
             $xRegisteredObject = $this->make($c->g($sReflectionClass));
148 148
             // Initialize the object
149
-            if($xRegisteredObject instanceof CallableClass)
149
+            if ($xRegisteredObject instanceof CallableClass)
150 150
             {
151 151
                 // Set the protected attributes of the object
152 152
                 $cSetter = function($c, $sClassName) {
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 
160 160
             // Run the callback for class initialisation
161 161
             $aCallbacks = $c->g(CallbackManager::class)->getInitCallbacks();
162
-            foreach($aCallbacks as $xCallback)
162
+            foreach ($aCallbacks as $xCallback)
163 163
             {
164 164
                 call_user_func($xCallback, $xRegisteredObject);
165 165
             }
Please login to merge, or discard this patch.