Passed
Push — main ( aa41db...017a71 )
by Thierry
02:06
created
src/Di/Traits/RegisterTrait.php 2 patches
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -111,10 +111,12 @@  discard block
 block discarded – undo
111 111
         $sReflectionClass = $sClassName . '_ReflectionClass';
112 112
 
113 113
         // Prevent duplication
114
-        if($this->h($sReflectionClass)) // It's important not to use the class name here.
114
+        if($this->h($sReflectionClass)) {
115
+            // It's important not to use the class name here.
115 116
         {
116 117
             return;
117 118
         }
119
+        }
118 120
 
119 121
         // Make sure the registered class exists
120 122
         if(isset($aOptions['include']))
@@ -125,8 +127,7 @@  discard block
 block discarded – undo
125 127
         try
126 128
         {
127 129
             $this->val($sReflectionClass, new ReflectionClass($sClassName));
128
-        }
129
-        catch(ReflectionException $e)
130
+        } catch(ReflectionException $e)
130 131
         {
131 132
             $xTranslator = $this->g(Translator::class);
132 133
             $sMessage = $xTranslator->trans('errors.class.invalid', ['name' => $sClassName]);
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      */
34 34
     private function setDiAttributes($xRegisteredObject, array $aDiOptions)
35 35
     {
36
-        foreach($aDiOptions as $sName => $sClass)
36
+        foreach ($aDiOptions as $sName => $sClass)
37 37
         {
38 38
             // Set the protected attributes of the object
39 39
             $cSetter = function($xInjectedObject) use($sName) {
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
         $this->setDiAttributes($xRegisteredObject, $aDiOptions);
64 64
 
65 65
         // Set the Jaxon request target in the helper
66
-        if($xRegisteredObject instanceof CallableClass)
66
+        if ($xRegisteredObject instanceof CallableClass)
67 67
         {
68 68
             // Set the protected attributes of the object
69 69
             $cSetter = function() use($xTarget) {
@@ -91,13 +91,13 @@  discard block
 block discarded – undo
91 91
         $sReflectionClass = $sClassName . '_ReflectionClass';
92 92
 
93 93
         // Prevent duplication
94
-        if($this->h($sReflectionClass)) // It's important not to use the class name here.
94
+        if ($this->h($sReflectionClass)) // It's important not to use the class name here.
95 95
         {
96 96
             return;
97 97
         }
98 98
 
99 99
         // Make sure the registered class exists
100
-        if(isset($aOptions['include']))
100
+        if (isset($aOptions['include']))
101 101
         {
102 102
             require_once($aOptions['include']);
103 103
         }
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
         {
107 107
             $this->val($sReflectionClass, new ReflectionClass($sClassName));
108 108
         }
109
-        catch(ReflectionException $e)
109
+        catch (ReflectionException $e)
110 110
         {
111 111
             $xTranslator = $this->g(Translator::class);
112 112
             $sMessage = $xTranslator->trans('errors.class.invalid', ['name' => $sClassName]);
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
         });
131 131
 
132 132
         // Register the user class, but only if the user didn't already.
133
-        if(!$this->h($sClassName))
133
+        if (!$this->h($sClassName))
134 134
         {
135 135
             $this->set($sClassName, function($di) use($sReflectionClass) {
136 136
                 return $this->make($di->g($sReflectionClass));
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
         // Initialize the user class instance
140 140
         $this->xLibContainer->extend($sClassName, function($xRegisteredObject)
141 141
             use($sCallableObject, $sClassName) {
142
-            if($xRegisteredObject instanceof CallableClass)
142
+            if ($xRegisteredObject instanceof CallableClass)
143 143
             {
144 144
                 $cSetter = function($di) use($sClassName) {
145 145
                     // Set the protected attributes of the object
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 
153 153
             // Run the callbacks for class initialisation
154 154
             $aCallbacks = $this->g(CallbackManager::class)->getInitCallbacks();
155
-            foreach($aCallbacks as $xCallback)
155
+            foreach ($aCallbacks as $xCallback)
156 156
             {
157 157
                 call_user_func($xCallback, $xRegisteredObject);
158 158
             }
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
     public function registerPackage(string $sClassName, Config $xPkgConfig)
205 205
     {
206 206
         // Register the user class, but only if the user didn't already.
207
-        if(!$this->h($sClassName))
207
+        if (!$this->h($sClassName))
208 208
         {
209 209
             $this->set($sClassName, function() use($sClassName) {
210 210
                 return $this->make($sClassName);
Please login to merge, or discard this patch.
src/Request/Call/Parameter.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -134,23 +134,23 @@  discard block
 block discarded – undo
134 134
      */
135 135
     public static function make($xValue): ParameterInterface
136 136
     {
137
-        if($xValue instanceof ParameterInterface)
137
+        if ($xValue instanceof ParameterInterface)
138 138
         {
139 139
             return $xValue;
140 140
         }
141
-        if(is_numeric($xValue))
141
+        if (is_numeric($xValue))
142 142
         {
143 143
             return new Parameter(self::NUMERIC_VALUE, $xValue);
144 144
         }
145
-        if(is_string($xValue))
145
+        if (is_string($xValue))
146 146
         {
147 147
             return new Parameter(self::QUOTED_VALUE, $xValue);
148 148
         }
149
-        if(is_bool($xValue))
149
+        if (is_bool($xValue))
150 150
         {
151 151
             return new Parameter(self::BOOL_VALUE, $xValue);
152 152
         }
153
-        if($xValue instanceof JsCall)
153
+        if ($xValue instanceof JsCall)
154 154
         {
155 155
             return new Parameter(self::JS_CALL, $xValue);
156 156
         }
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
      */
253 253
     protected function getNumericValueScript(): string
254 254
     {
255
-        return (string)$this->xValue;
255
+        return (string) $this->xValue;
256 256
     }
257 257
 
258 258
     /**
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
      */
263 263
     protected function getUnquotedValueScript(): string
264 264
     {
265
-        return (string)$this->xValue;
265
+        return (string) $this->xValue;
266 266
     }
267 267
 
268 268
     /**
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
      */
285 285
     protected function getPageNumberScript(): string
286 286
     {
287
-        return (string)$this->xValue;
287
+        return (string) $this->xValue;
288 288
     }
289 289
 
290 290
     /**
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
     public function getScript(): string
306 306
     {
307 307
         $sMethodName = 'get' . $this->sType . 'Script';
308
-        if(!method_exists($this, $sMethodName))
308
+        if (!method_exists($this, $sMethodName))
309 309
         {
310 310
             return '';
311 311
         }
Please login to merge, or discard this patch.
src/Request/Call/Call.php 1 patch
Spacing   +12 added lines, -13 removed lines patch added patch discarded remove patch
@@ -79,18 +79,18 @@  discard block
 block discarded – undo
79 79
      */
80 80
     private function makePhrase(array $aArgs): string
81 81
     {
82
-        if(empty($aArgs))
82
+        if (empty($aArgs))
83 83
         {
84 84
             return '';
85 85
         }
86 86
         // The first array entry is the message.
87 87
         $sPhrase = array_shift($aArgs);
88
-        if(empty($aArgs))
88
+        if (empty($aArgs))
89 89
         {
90 90
             return $sPhrase;
91 91
         }
92 92
         $nParamId = 1;
93
-        foreach($aArgs as &$xParameter)
93
+        foreach ($aArgs as &$xParameter)
94 94
         {
95 95
             $xParameter = "'$nParamId':" . $xParameter->getScript();
96 96
             $nParamId++;
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
      */
106 106
     private function makeMessage(): string
107 107
     {
108
-        if(!($sPhrase = $this->makePhrase($this->aMessageArgs)))
108
+        if (!($sPhrase = $this->makePhrase($this->aMessageArgs)))
109 109
         {
110 110
             return '';
111 111
         }
@@ -124,16 +124,15 @@  discard block
 block discarded – undo
124 124
     {
125 125
         $sMessageScript = $this->makeMessage();
126 126
         $sScript = parent::getScript();
127
-        if($this->bConfirm)
127
+        if ($this->bConfirm)
128 128
         {
129 129
             $sConfirmPhrase = $this->makePhrase($this->aConfirmArgs);
130 130
             $sScript = $this->xDialogLibraryManager->getQuestionLibrary()
131 131
                 ->confirm($sConfirmPhrase, $sScript, $sMessageScript);
132 132
         }
133
-        if($this->sCondition !== '')
133
+        if ($this->sCondition !== '')
134 134
         {
135
-            $sScript = empty($sMessageScript) ? 'if(' . $this->sCondition . '){' . $sScript . ';}' :
136
-                'if(' . $this->sCondition . '){' . $sScript . ';}else{' . $sMessageScript . ';}';
135
+            $sScript = empty($sMessageScript) ? 'if(' . $this->sCondition . '){' . $sScript . ';}' : 'if(' . $this->sCondition . '){' . $sScript . ';}else{' . $sMessageScript . ';}';
137 136
         }
138 137
         return $this->sVars . $sScript;
139 138
     }
@@ -145,9 +144,9 @@  discard block
 block discarded – undo
145 144
      */
146 145
     public function hasPageNumber(): bool
147 146
     {
148
-        foreach($this->aParameters as $xParameter)
147
+        foreach ($this->aParameters as $xParameter)
149 148
         {
150
-            if($xParameter->getType() === Parameter::PAGE_NUMBER)
149
+            if ($xParameter->getType() === Parameter::PAGE_NUMBER)
151 150
             {
152 151
                 return true;
153 152
             }
@@ -165,9 +164,9 @@  discard block
 block discarded – undo
165 164
     public function setPageNumber(int $nPageNumber): Call
166 165
     {
167 166
         // Set the value of the Parameter::PAGE_NUMBER parameter
168
-        foreach($this->aParameters as $xParameter)
167
+        foreach ($this->aParameters as $xParameter)
169 168
         {
170
-            if($xParameter->getType() === Parameter::PAGE_NUMBER)
169
+            if ($xParameter->getType() === Parameter::PAGE_NUMBER)
171 170
             {
172 171
                 $xParameter->setValue($nPageNumber);
173 172
                 break;
@@ -188,7 +187,7 @@  discard block
 block discarded – undo
188 187
     public function pg(int $nCurrentPage, int $nItemsPerPage, int $nItemsTotal): Paginator
189 188
     {
190 189
         // Append the page number to the parameter list, if not yet given.
191
-        if(!$this->hasPageNumber())
190
+        if (!$this->hasPageNumber())
192 191
         {
193 192
             $this->addParameter(Parameter::PAGE_NUMBER, 0);
194 193
         }
Please login to merge, or discard this patch.
src/Request/Call/JsCall.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -121,7 +121,7 @@
 block discarded – undo
121 121
      */
122 122
     public function addParameters(array $aParameters): JsCall
123 123
     {
124
-        foreach($aParameters as $xParameter)
124
+        foreach ($aParameters as $xParameter)
125 125
         {
126 126
             $this->pushParameter(Parameter::make($xParameter));
127 127
         }
Please login to merge, or discard this patch.
src/Plugin/Response/JQuery/DomSelector.php 1 patch
Spacing   +6 added lines, -7 removed lines patch added patch discarded remove patch
@@ -86,12 +86,12 @@  discard block
 block discarded – undo
86 86
      */
87 87
     private function getPath(string $jQueryNs, string $sPath, $xContext)
88 88
     {
89
-        if(!$sPath)
89
+        if (!$sPath)
90 90
         {
91 91
             // If an empty selector is given, use the event target instead
92 92
             return "$jQueryNs(e.currentTarget)";
93 93
         }
94
-        if(!$xContext)
94
+        if (!$xContext)
95 95
         {
96 96
             return "$jQueryNs('" . $sPath . "')";
97 97
         }
@@ -110,12 +110,12 @@  discard block
 block discarded – undo
110 110
      */
111 111
     public function __call(string $sMethod, array $aArguments)
112 112
     {
113
-        if(count($aArguments) === 1)
113
+        if (count($aArguments) === 1)
114 114
         {
115 115
             // If the only parameter is a selector, and the first call
116 116
             // on that selector is a method, then the selector is a callback.
117 117
             $xArgument = $aArguments[0];
118
-            if(is_a($xArgument, self::class) && $xArgument->bIsCallback === null &&
118
+            if (is_a($xArgument, self::class) && $xArgument->bIsCallback === null &&
119 119
                 count($xArgument->aCalls) > 0 && is_a($xArgument->aCalls[0], JsCall::class))
120 120
             {
121 121
                 $xArgument->bIsCallback = true;
@@ -188,12 +188,11 @@  discard block
 block discarded – undo
188 188
     public function getScript(): string
189 189
     {
190 190
         $sScript = $this->sPath;
191
-        if(count($this->aCalls) > 0)
191
+        if (count($this->aCalls) > 0)
192 192
         {
193 193
             $sScript .= '.' . implode('.', $this->aCalls);
194 194
         }
195
-        return $this->bIsCallback ? '(e) => {' . $sScript . '}' :
196
-            ($this->bToInt ? "parseInt($sScript)" : $sScript);
195
+        return $this->bIsCallback ? '(e) => {' . $sScript . '}' : ($this->bToInt ? "parseInt($sScript)" : $sScript);
197 196
     }
198 197
 
199 198
     /**
Please login to merge, or discard this patch.
src/Plugin/Code/CodeGenerator.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
      */
116 116
     public function addCodeGenerator(string $sClassName, int $nPriority)
117 117
     {
118
-        while(isset($this->aCodeGenerators[$nPriority]))
118
+        while (isset($this->aCodeGenerators[$nPriority]))
119 119
         {
120 120
             $nPriority++;
121 121
         }
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
     private function generatePluginCodes(string $sClassName)
159 159
     {
160 160
         $xGenerator = $this->di->g($sClassName);
161
-        if(!is_subclass_of($xGenerator, Plugin::class) || $this->xAssetManager->shallIncludeAssets($xGenerator))
161
+        if (!is_subclass_of($xGenerator, Plugin::class) || $this->xAssetManager->shallIncludeAssets($xGenerator))
162 162
         {
163 163
             // HTML tags for CSS
164 164
             $this->sCss = trim($this->sCss) . "\n" . trim($xGenerator->getCss(), " \n");
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
         }
168 168
         // Javascript code
169 169
         $this->sJsScript = trim($this->sJsScript) . "\n\n" . trim($xGenerator->getScript(), " \n");
170
-        if($xGenerator->readyEnabled())
170
+        if ($xGenerator->readyEnabled())
171 171
         {
172 172
             $sScriptAttr = $xGenerator->readyInlined() ? 'sJsInlineScript' : 'sJsReadyScript';
173 173
             $this->$sScriptAttr = trim($this->$sScriptAttr) . "\n\n" . trim($xGenerator->getReadyScript(), " \n");
@@ -186,11 +186,11 @@  discard block
 block discarded – undo
186 186
         $this->sJsScript = trim($this->sJsScript, " \n");
187 187
         $this->sJsReadyScript = trim($this->sJsReadyScript, " \n");
188 188
         $this->sJsInlineScript = trim($this->sJsInlineScript, " \n");
189
-        if(($this->sJsReadyScript))
189
+        if (($this->sJsReadyScript))
190 190
         {
191 191
             $this->sJsReadyScript = $this->render('ready.js', ['sScript' => $this->sJsReadyScript . "\n"]);
192 192
         }
193
-        if(($this->sJsInlineScript))
193
+        if (($this->sJsInlineScript))
194 194
         {
195 195
             $this->sJsInlineScript = $this->render('ready.js', ['sScript' => $this->sJsInlineScript . "\n"]);
196 196
         }
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
      */
208 208
     private function generateCodes()
209 209
     {
210
-        if($this->bGenerated)
210
+        if ($this->bGenerated)
211 211
         {
212 212
             return;
213 213
         }
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 
218 218
         $this->xAssetManager = $this->di->getAssetManager();
219 219
         $this->sJsOptions = $this->xAssetManager->getJsOptions();
220
-        foreach($this->aCodeGenerators as $sClassName)
220
+        foreach ($this->aCodeGenerators as $sClassName)
221 221
         {
222 222
             $this->generatePluginCodes($sClassName);
223 223
         }
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
             trim($this->sJsScript) . "\n\n" . trim($this->sJsReadyScript);
230 230
         // For js lib versions prior to 4.0, register the redirect command.
231 231
         $sJsLibVersion = $this->di->getJsLibVersion();
232
-        if((int)$sJsLibVersion[0] < 4)
232
+        if ((int) $sJsLibVersion[0] < 4)
233 233
         {
234 234
             $this->sJsScript .= '
235 235
 
@@ -296,16 +296,16 @@  discard block
 block discarded – undo
296 296
     {
297 297
         $this->generateCodes();
298 298
         $sScript = '';
299
-        if(($bIncludeCss))
299
+        if (($bIncludeCss))
300 300
         {
301 301
             $sScript .= $this->getCss() . "\n";
302 302
         }
303
-        if(($bIncludeJs))
303
+        if (($bIncludeJs))
304 304
         {
305 305
             $sScript .= $this->getJs() . "\n";
306 306
         }
307 307
 
308
-        if(!($sUrl = $this->xAssetManager->createJsFiles($this)))
308
+        if (!($sUrl = $this->xAssetManager->createJsFiles($this)))
309 309
         {
310 310
             return trim($sScript) . "\n\n" . $this->render('wrapper.js',
311 311
                 ['sScript' => trim($this->sJsScript) . "\n\n" . trim($this->sJsInlineScript)]);
Please login to merge, or discard this patch.
src/Plugin/Manager/PluginManager.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -124,28 +124,28 @@  discard block
 block discarded – undo
124 124
     {
125 125
         $bIsUsed = false;
126 126
         $aInterfaces = class_implements($sClassName);
127
-        if(in_array(CodeGeneratorInterface::class, $aInterfaces))
127
+        if (in_array(CodeGeneratorInterface::class, $aInterfaces))
128 128
         {
129 129
             $this->xCodeGenerator->addCodeGenerator($sClassName, $nPriority);
130 130
             $bIsUsed = true;
131 131
         }
132
-        if(in_array(CallableRegistryInterface::class, $aInterfaces))
132
+        if (in_array(CallableRegistryInterface::class, $aInterfaces))
133 133
         {
134 134
             $this->aRegistryPlugins[$sPluginName] = $sClassName;
135 135
             $bIsUsed = true;
136 136
         }
137
-        if(in_array(RequestHandlerInterface::class, $aInterfaces))
137
+        if (in_array(RequestHandlerInterface::class, $aInterfaces))
138 138
         {
139 139
             $this->aRequestHandlers[$sPluginName] = $sClassName;
140 140
             $bIsUsed = true;
141 141
         }
142
-        if(in_array(ResponsePluginInterface::class, $aInterfaces))
142
+        if (in_array(ResponsePluginInterface::class, $aInterfaces))
143 143
         {
144 144
             $this->aResponsePlugins[$sPluginName] = $sClassName;
145 145
             $bIsUsed = true;
146 146
         }
147 147
 
148
-        if(!$bIsUsed)
148
+        if (!$bIsUsed)
149 149
         {
150 150
             // The class is invalid.
151 151
             $sMessage = $this->xTranslator->trans('errors.register.invalid', ['name' => $sClassName]);
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
         }
154 154
 
155 155
         // Register the plugin in the DI container, if necessary
156
-        if(!$this->di->has($sClassName))
156
+        if (!$this->di->has($sClassName))
157 157
         {
158 158
             $this->di->auto($sClassName);
159 159
         }
@@ -169,12 +169,12 @@  discard block
 block discarded – undo
169 169
      */
170 170
     public function getResponsePlugin(string $sName, ?ResponseInterface $xResponse = null): ?ResponsePlugin
171 171
     {
172
-        if(!isset($this->aResponsePlugins[$sName]))
172
+        if (!isset($this->aResponsePlugins[$sName]))
173 173
         {
174 174
             return null;
175 175
         }
176 176
         $xPlugin = $this->di->g($this->aResponsePlugins[$sName]);
177
-        if(($xResponse))
177
+        if (($xResponse))
178 178
         {
179 179
             $xPlugin->setResponse($xResponse);
180 180
         }
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
      */
196 196
     public function registerCallable(string $sType, string $sCallable, $xOptions = [])
197 197
     {
198
-        if(isset($this->aRegistryPlugins[$sType]) &&
198
+        if (isset($this->aRegistryPlugins[$sType]) &&
199 199
             ($xPlugin = $this->di->g($this->aRegistryPlugins[$sType])))
200 200
         {
201 201
             $xPlugin->register($sType, $sCallable, $xPlugin->checkOptions($sCallable, $xOptions));
Please login to merge, or discard this patch.
src/Response/Response.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
      */
87 87
     public function getOutput(): string
88 88
     {
89
-        if($this->getCommandCount() === 0)
89
+        if ($this->getCommandCount() === 0)
90 90
         {
91 91
             return '{}';
92 92
         }
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
     public function addCommand(array $aAttributes, $mData): ResponseInterface
176 176
     {
177 177
         $aAttributes = array_map(function($xAttribute) {
178
-            return is_integer($xAttribute) ? $xAttribute : trim((string)$xAttribute, " \t");
178
+            return is_integer($xAttribute) ? $xAttribute : trim((string) $xAttribute, " \t");
179 179
         }, $aAttributes);
180 180
         return $this->addRawCommand($aAttributes, $mData);
181 181
     }
@@ -194,9 +194,9 @@  discard block
 block discarded – undo
194 194
         $mData, bool $bRemoveEmpty = false): ResponseInterface
195 195
     {
196 196
         $mData = is_array($mData) ? array_map(function($sData) {
197
-            return trim((string)$sData, " \t\n");
198
-        }, $mData) : trim((string)$mData, " \t\n");
199
-        if($bRemoveEmpty)
197
+            return trim((string) $sData, " \t\n");
198
+        }, $mData) : trim((string) $mData, " \t\n");
199
+        if ($bRemoveEmpty)
200 200
         {
201 201
             $aAttributes = array_filter($aAttributes, function($xValue) {
202 202
                 return $xValue === '';
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
     public function toPsr(): PsrResponseInterface
230 230
     {
231 231
         $xPsrResponse = $this->xPsr17Factory->createResponse(200);
232
-        if($this->xRequest->getMethod() === 'GET')
232
+        if ($this->xRequest->getMethod() === 'GET')
233 233
         {
234 234
             $xPsrResponse = $xPsrResponse
235 235
                 ->withHeader('Expires', 'Mon, 26 Jul 1997 05:00:00 GMT')
Please login to merge, or discard this patch.
src/Plugin/Request/CallableClass/CallableObjectOptions.php 3 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -186,8 +186,7 @@
 block discarded – undo
186 186
             if(is_array($xMethodToCall))
187 187
             {
188 188
                 $aHookMethods[$sCalledMethod] = $xMethodToCall;
189
-            }
190
-            elseif(is_string($xMethodToCall))
189
+            } elseif(is_string($xMethodToCall))
191 190
             {
192 191
                 $aHookMethods[$sCalledMethod] = [$xMethodToCall];
193 192
             }
Please login to merge, or discard this patch.
Switch Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -231,19 +231,19 @@  discard block
 block discarded – undo
231 231
         switch($sName)
232 232
         {
233 233
         // Set the methods to call before processing the request
234
-        case '__before':
235
-            $this->setHookMethods($this->aBeforeMethods, $xValue);
236
-            break;
237
-        // Set the methods to call after processing the request
238
-        case '__after':
239
-            $this->setHookMethods($this->aAfterMethods, $xValue);
240
-            break;
241
-        // Set the attributes to inject in the callable object
242
-        case '__di':
243
-            $this->addDiOption($xValue);
244
-            break;
245
-        default:
246
-            break;
234
+            case '__before':
235
+                $this->setHookMethods($this->aBeforeMethods, $xValue);
236
+                break;
237
+            // Set the methods to call after processing the request
238
+            case '__after':
239
+                $this->setHookMethods($this->aAfterMethods, $xValue);
240
+                break;
241
+            // Set the attributes to inject in the callable object
242
+            case '__di':
243
+                $this->addDiOption($xValue);
244
+                break;
245
+            default:
246
+                break;
247 247
         }
248 248
     }
249 249
 
@@ -291,20 +291,20 @@  discard block
 block discarded – undo
291 291
     {
292 292
         switch($sOptionName)
293 293
         {
294
-        case 'excluded':
295
-            if((bool)$xOptionValue)
296
-            {
297
-                $this->addProtectedMethods($sFunctionName);
298
-            }
299
-            break;
300
-        // For databags, all the value are merged in a single array.
301
-        case 'bags':
302
-            $this->_addJsArrayOption($sFunctionName, $sOptionName, $xOptionValue);
303
-            return;
304
-        // For all the other options, including callback, only the last value is kept.
305
-        case 'callback':
306
-        default:
307
-            $this->_setJsOption($sFunctionName, $sOptionName, $xOptionValue);
294
+            case 'excluded':
295
+                if((bool)$xOptionValue)
296
+                {
297
+                    $this->addProtectedMethods($sFunctionName);
298
+                }
299
+                break;
300
+            // For databags, all the value are merged in a single array.
301
+            case 'bags':
302
+                $this->_addJsArrayOption($sFunctionName, $sOptionName, $xOptionValue);
303
+                return;
304
+            // For all the other options, including callback, only the last value is kept.
305
+            case 'callback':
306
+            default:
307
+                $this->_setJsOption($sFunctionName, $sOptionName, $xOptionValue);
308 308
         }
309 309
     }
310 310
 
Please login to merge, or discard this patch.
Spacing   +22 added lines, -24 removed lines patch added patch discarded remove patch
@@ -81,29 +81,29 @@  discard block
 block discarded – undo
81 81
     public function __construct(array $aOptions, array $aAnnotations)
82 82
     {
83 83
         [$bExcluded, $aAnnotationOptions, $aAnnotationProtected] = $aAnnotations;
84
-        $this->bExcluded = $bExcluded || (bool)($aOptions['excluded'] ?? false);
85
-        if($this->bExcluded)
84
+        $this->bExcluded = $bExcluded || (bool) ($aOptions['excluded'] ?? false);
85
+        if ($this->bExcluded)
86 86
         {
87 87
             return;
88 88
         }
89 89
 
90 90
         $sSeparator = $aOptions['separator'];
91
-        if($sSeparator === '_' || $sSeparator === '.')
91
+        if ($sSeparator === '_' || $sSeparator === '.')
92 92
         {
93 93
             $this->sSeparator = $sSeparator;
94 94
         }
95 95
         $this->addProtectedMethods($aOptions['protected']);
96 96
         $this->addProtectedMethods($aAnnotationProtected);
97 97
 
98
-        foreach($aOptions['functions'] as $sNames => $aFunctionOptions)
98
+        foreach ($aOptions['functions'] as $sNames => $aFunctionOptions)
99 99
         {
100 100
             $aFunctionNames = explode(',', $sNames); // Names are in comma-separated list.
101
-            foreach($aFunctionNames as $sFunctionName)
101
+            foreach ($aFunctionNames as $sFunctionName)
102 102
             {
103 103
                 $this->addFunctionOptions($sFunctionName, $aFunctionOptions);
104 104
             }
105 105
         }
106
-        foreach($aAnnotationOptions as $sFunctionName => $aFunctionOptions)
106
+        foreach ($aAnnotationOptions as $sFunctionName => $aFunctionOptions)
107 107
         {
108 108
             $this->addFunctionOptions($sFunctionName, $aFunctionOptions);
109 109
         }
@@ -116,14 +116,14 @@  discard block
 block discarded – undo
116 116
      */
117 117
     private function addProtectedMethods($xMethods)
118 118
     {
119
-        if(!is_array($xMethods))
119
+        if (!is_array($xMethods))
120 120
         {
121
-            $this->aProtectedMethods[trim((string)$xMethods)] = true;
121
+            $this->aProtectedMethods[trim((string) $xMethods)] = true;
122 122
             return;
123 123
         }
124
-        foreach($xMethods as $sMethod)
124
+        foreach ($xMethods as $sMethod)
125 125
         {
126
-            $this->aProtectedMethods[trim((string)$sMethod)] = true;
126
+            $this->aProtectedMethods[trim((string) $sMethod)] = true;
127 127
         }
128 128
     }
129 129
 
@@ -197,13 +197,13 @@  discard block
 block discarded – undo
197 197
      */
198 198
     private function setHookMethods(array &$aHookMethods, $xValue)
199 199
     {
200
-        foreach($xValue as $sCalledMethod => $xMethodToCall)
200
+        foreach ($xValue as $sCalledMethod => $xMethodToCall)
201 201
         {
202
-            if(is_array($xMethodToCall))
202
+            if (is_array($xMethodToCall))
203 203
             {
204 204
                 $aHookMethods[$sCalledMethod] = $xMethodToCall;
205 205
             }
206
-            elseif(is_string($xMethodToCall))
206
+            elseif (is_string($xMethodToCall))
207 207
             {
208 208
                 $aHookMethods[$sCalledMethod] = [$xMethodToCall];
209 209
             }
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
      */
229 229
     private function addOption(string $sName, $xValue)
230 230
     {
231
-        switch($sName)
231
+        switch ($sName)
232 232
         {
233 233
         // Set the methods to call before processing the request
234 234
         case '__before':
@@ -256,11 +256,11 @@  discard block
 block discarded – undo
256 256
      */
257 257
     private function _addJsArrayOption(string $sFunctionName, string $sOptionName, $xOptionValue)
258 258
     {
259
-        if(is_string($xOptionValue))
259
+        if (is_string($xOptionValue))
260 260
         {
261 261
             $xOptionValue = [$xOptionValue];
262 262
         }
263
-        if(!is_array($xOptionValue))
263
+        if (!is_array($xOptionValue))
264 264
         {
265 265
             return; // Do not save.
266 266
         }
@@ -289,10 +289,10 @@  discard block
 block discarded – undo
289 289
      */
290 290
     private function addJsOption(string $sFunctionName, string $sOptionName, $xOptionValue)
291 291
     {
292
-        switch($sOptionName)
292
+        switch ($sOptionName)
293 293
         {
294 294
         case 'excluded':
295
-            if((bool)$xOptionValue)
295
+            if ((bool) $xOptionValue)
296 296
             {
297 297
                 $this->addProtectedMethods($sFunctionName);
298 298
             }
@@ -316,12 +316,11 @@  discard block
 block discarded – undo
316 316
      */
317 317
     private function addFunctionOptions(string $sFunctionName, array $aFunctionOptions)
318 318
     {
319
-        foreach($aFunctionOptions as $sOptionName => $xOptionValue)
319
+        foreach ($aFunctionOptions as $sOptionName => $xOptionValue)
320 320
         {
321 321
             substr($sOptionName, 0, 2) === '__' ?
322 322
                 // Options for PHP classes. They start with "__".
323
-                $this->addOption($sOptionName, [$sFunctionName => $xOptionValue]) :
324
-                // Options for javascript code.
323
+                $this->addOption($sOptionName, [$sFunctionName => $xOptionValue]) : // Options for javascript code.
325 324
                 $this->addJsOption($sFunctionName, $sOptionName, $xOptionValue);
326 325
         }
327 326
     }
@@ -337,12 +336,11 @@  discard block
 block discarded – undo
337 336
         $aOptions = array_merge($this->aJsOptions['*'] ?? []); // Clone the array
338 337
         // Then add the method options.
339 338
         $aMethodOptions = $this->aJsOptions[$sMethodName] ?? [];
340
-        foreach($aMethodOptions as $sOptionName => $xOptionValue)
339
+        foreach ($aMethodOptions as $sOptionName => $xOptionValue)
341 340
         {
342 341
             // For databags, merge the values in a single array.
343 342
             // For all the other options, including callback, keep the last value.
344
-            $aOptions[$sOptionName] = $sOptionName !== 'bags' ? $xOptionValue :
345
-                array_unique(array_merge($aOptions[$sOptionName] ?? [], $xOptionValue));
343
+            $aOptions[$sOptionName] = $sOptionName !== 'bags' ? $xOptionValue : array_unique(array_merge($aOptions[$sOptionName] ?? [], $xOptionValue));
346 344
         }
347 345
         return $aOptions;
348 346
     }
Please login to merge, or discard this patch.