Passed
Push — master ( 2b82aa...8beeac )
by Thierry
06:23 queued 03:53
created
src/Request/Call/Call.php 2 patches
Spacing   +16 added lines, -17 removed lines patch added patch discarded remove patch
@@ -79,10 +79,10 @@  discard block
 block discarded – undo
79 79
      */
80 80
     private function _makeUniqueJsVar(ParameterInterface $xParameter): ParameterInterface
81 81
     {
82
-        if($xParameter instanceof DomSelector)
82
+        if ($xParameter instanceof DomSelector)
83 83
         {
84 84
             $sParameterStr = $xParameter->getScript();
85
-            if(!isset($this->aVariables[$sParameterStr]))
85
+            if (!isset($this->aVariables[$sParameterStr]))
86 86
             {
87 87
                 // The value is not yet defined. A new variable is created.
88 88
                 $sVarName = 'jxnVar' . $this->nVarId;
@@ -109,18 +109,18 @@  discard block
 block discarded – undo
109 109
      */
110 110
     private function makePhrase(array $aArgs): string
111 111
     {
112
-        if(empty($aArgs))
112
+        if (empty($aArgs))
113 113
         {
114 114
             return '';
115 115
         }
116 116
         // The first array entry is the message.
117 117
         $sPhrase = array_shift($aArgs);
118
-        if(empty($aArgs))
118
+        if (empty($aArgs))
119 119
         {
120 120
             return $sPhrase;
121 121
         }
122 122
         $nParamId = 1;
123
-        foreach($aArgs as &$xParameter)
123
+        foreach ($aArgs as &$xParameter)
124 124
         {
125 125
             $xParameter = $this->_makeUniqueJsVar($xParameter);
126 126
             $xParameter = "'$nParamId':" . $xParameter->getScript();
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
      */
138 138
     private function makeMessage(): string
139 139
     {
140
-        if(!($sPhrase = $this->makePhrase($this->aMessageArgs)))
140
+        if (!($sPhrase = $this->makePhrase($this->aMessageArgs)))
141 141
         {
142 142
             return '';
143 143
         }
@@ -166,23 +166,22 @@  discard block
 block discarded – undo
166 166
         // This array will avoid declaring multiple variables with the same value.
167 167
         // The array key is the variable value, while the array value is the variable name.
168 168
         $this->aVariables = []; // Array of local variables.
169
-        foreach($this->aParameters as &$xParameter)
169
+        foreach ($this->aParameters as &$xParameter)
170 170
         {
171 171
             $xParameter = $this->_makeUniqueJsVar($xParameter);
172 172
         }
173 173
 
174 174
         $sMessageScript = $this->makeMessage();
175 175
         $sScript = parent::getScript();
176
-        if($this->sCondition === '__confirm__')
176
+        if ($this->sCondition === '__confirm__')
177 177
         {
178 178
             $sConfirmPhrase = $this->makePhrase($this->aConfirmArgs);
179 179
             $sScript = $this->xDialogLibraryManager->getQuestionLibrary()
180 180
                 ->confirm($sConfirmPhrase, $sScript, $sMessageScript);
181 181
         }
182
-        elseif($this->sCondition !== '')
182
+        elseif ($this->sCondition !== '')
183 183
         {
184
-            $sScript = empty($sMessageScript) ? 'if(' . $this->sCondition . '){' . $sScript . ';}' :
185
-                'if(' . $this->sCondition . '){' . $sScript . ';}else{' . $sMessageScript . ';}';
184
+            $sScript = empty($sMessageScript) ? 'if(' . $this->sCondition . '){' . $sScript . ';}' : 'if(' . $this->sCondition . '){' . $sScript . ';}else{' . $sMessageScript . ';}';
186 185
         }
187 186
         return $this->sVars . $sScript;
188 187
     }
@@ -194,9 +193,9 @@  discard block
 block discarded – undo
194 193
      */
195 194
     public function hasPageNumber(): bool
196 195
     {
197
-        foreach($this->aParameters as $xParameter)
196
+        foreach ($this->aParameters as $xParameter)
198 197
         {
199
-            if($xParameter->getType() === Parameter::PAGE_NUMBER)
198
+            if ($xParameter->getType() === Parameter::PAGE_NUMBER)
200 199
             {
201 200
                 return true;
202 201
             }
@@ -214,9 +213,9 @@  discard block
 block discarded – undo
214 213
     public function setPageNumber(int $nPageNumber): Call
215 214
     {
216 215
         // Set the value of the Parameter::PAGE_NUMBER parameter
217
-        foreach($this->aParameters as $xParameter)
216
+        foreach ($this->aParameters as $xParameter)
218 217
         {
219
-            if($xParameter->getType() === Parameter::PAGE_NUMBER)
218
+            if ($xParameter->getType() === Parameter::PAGE_NUMBER)
220 219
             {
221 220
                 $xParameter->setValue($nPageNumber);
222 221
                 break;
@@ -237,7 +236,7 @@  discard block
 block discarded – undo
237 236
     public function pages(int $nCurrentPage, int $nItemsPerPage, int $nItemsTotal): array
238 237
     {
239 238
         // Append the page number to the parameter list, if not yet given.
240
-        if(!$this->hasPageNumber())
239
+        if (!$this->hasPageNumber())
241 240
         {
242 241
             $this->addParameter(Parameter::PAGE_NUMBER, 0);
243 242
         }
@@ -256,7 +255,7 @@  discard block
 block discarded – undo
256 255
     public function paginate(int $nCurrentPage, int $nItemsPerPage, int $nItemsTotal): Paginator
257 256
     {
258 257
         // Append the page number to the parameter list, if not yet given.
259
-        if(!$this->hasPageNumber())
258
+        if (!$this->hasPageNumber())
260 259
         {
261 260
             $this->addParameter(Parameter::PAGE_NUMBER, 0);
262 261
         }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -89,8 +89,7 @@  discard block
 block discarded – undo
89 89
                 $this->aVariables[$sParameterStr] = $sVarName;
90 90
                 $this->sVars .= "$sVarName=$xParameter;";
91 91
                 $this->nVarId++;
92
-            }
93
-            else
92
+            } else
94 93
             {
95 94
                 // The value is already defined. The corresponding variable is assigned.
96 95
                 $sVarName = $this->aVariables[$sParameterStr];
@@ -178,8 +177,7 @@  discard block
 block discarded – undo
178 177
             $sConfirmPhrase = $this->makePhrase($this->aConfirmArgs);
179 178
             $sScript = $this->xDialogLibraryManager->getQuestionLibrary()
180 179
                 ->confirm($sConfirmPhrase, $sScript, $sMessageScript);
181
-        }
182
-        elseif($this->sCondition !== '')
180
+        } elseif($this->sCondition !== '')
183 181
         {
184 182
             $sScript = empty($sMessageScript) ? 'if(' . $this->sCondition . '){' . $sScript . ';}' :
185 183
                 'if(' . $this->sCondition . '){' . $sScript . ';}else{' . $sMessageScript . ';}';
Please login to merge, or discard this patch.
src/Request/Call/Paginator.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
      */
146 146
     protected function updateTotalPages(): Paginator
147 147
     {
148
-        $this->nTotalPages = ($this->nItemsPerPage === 0 ? 0 : (int)ceil($this->nTotalItems / $this->nItemsPerPage));
148
+        $this->nTotalPages = ($this->nItemsPerPage === 0 ? 0 : (int) ceil($this->nTotalItems / $this->nItemsPerPage));
149 149
         return $this;
150 150
     }
151 151
 
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
      */
221 221
     protected function getPrevLink(): array
222 222
     {
223
-        if($this->nCurrentPage <= 1)
223
+        if ($this->nCurrentPage <= 1)
224 224
         {
225 225
             return ['disabled', $this->sPreviousText, ''];
226 226
         }
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
      */
235 235
     protected function getNextLink(): array
236 236
     {
237
-        if($this->nCurrentPage >= $this->nTotalPages)
237
+        if ($this->nCurrentPage >= $this->nTotalPages)
238 238
         {
239 239
             return ['disabled', $this->sNextText, ''];
240 240
         }
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
      */
251 251
     protected function getPageLink(int $nNumber): array
252 252
     {
253
-        if($nNumber < 1)
253
+        if ($nNumber < 1)
254 254
         {
255 255
             return ['disabled', $this->sEllipsysText, ''];
256 256
         }
@@ -269,9 +269,9 @@  discard block
 block discarded – undo
269 269
     {
270 270
         $aPageNumbers = [];
271 271
 
272
-        if($this->nTotalPages <= $this->nMaxPages)
272
+        if ($this->nTotalPages <= $this->nMaxPages)
273 273
         {
274
-            for($i = 0; $i < $this->nTotalPages; $i++)
274
+            for ($i = 0; $i < $this->nTotalPages; $i++)
275 275
             {
276 276
                 $aPageNumbers[] = $i + 1;
277 277
             }
@@ -280,11 +280,11 @@  discard block
 block discarded – undo
280 280
         }
281 281
 
282 282
         // Determine the sliding range, centered around the current page.
283
-        $nNumAdjacents = (int)floor(($this->nMaxPages - 4) / 2);
283
+        $nNumAdjacents = (int) floor(($this->nMaxPages - 4) / 2);
284 284
 
285 285
         $nSlidingStart = 1;
286 286
         $nSlidingEndOffset = $nNumAdjacents + 3 - $this->nCurrentPage;
287
-        if($nSlidingEndOffset < 0)
287
+        if ($nSlidingEndOffset < 0)
288 288
         {
289 289
             $nSlidingStart = $this->nCurrentPage - $nNumAdjacents;
290 290
             $nSlidingEndOffset = 0;
@@ -292,23 +292,23 @@  discard block
 block discarded – undo
292 292
 
293 293
         $nSlidingEnd = $this->nTotalPages;
294 294
         $nSlidingStartOffset = $this->nCurrentPage + $nNumAdjacents + 2 - $this->nTotalPages;
295
-        if($nSlidingStartOffset < 0)
295
+        if ($nSlidingStartOffset < 0)
296 296
         {
297 297
             $nSlidingEnd = $this->nCurrentPage + $nNumAdjacents;
298 298
             $nSlidingStartOffset = 0;
299 299
         }
300 300
 
301 301
         // Build the list of page numbers.
302
-        if($nSlidingStart > 1)
302
+        if ($nSlidingStart > 1)
303 303
         {
304 304
             $aPageNumbers[] = 1;
305 305
             $aPageNumbers[] = 0; // Ellipsys;
306 306
         }
307
-        for($i = $nSlidingStart - $nSlidingStartOffset; $i <= $nSlidingEnd + $nSlidingEndOffset; $i++)
307
+        for ($i = $nSlidingStart - $nSlidingStartOffset; $i <= $nSlidingEnd + $nSlidingEndOffset; $i++)
308 308
         {
309 309
             $aPageNumbers[] = $i;
310 310
         }
311
-        if($nSlidingEnd < $this->nTotalPages)
311
+        if ($nSlidingEnd < $this->nTotalPages)
312 312
         {
313 313
             $aPageNumbers[] = 0; // Ellipsys;
314 314
             $aPageNumbers[] = $this->nTotalPages;
@@ -341,13 +341,13 @@  discard block
 block discarded – undo
341 341
      */
342 342
     public function pages(): array
343 343
     {
344
-        if($this->nTotalPages < 2)
344
+        if ($this->nTotalPages < 2)
345 345
         {
346 346
             return [];
347 347
         }
348 348
 
349 349
         return array_map(function($aPage) {
350
-            return (object)['type' => $aPage[0], 'text' => $aPage[1], 'call' => $aPage[2]];
350
+            return (object) ['type' => $aPage[0], 'text' => $aPage[1], 'call' => $aPage[2]];
351 351
         }, $this->links());
352 352
     }
353 353
 
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
      */
376 376
     public function __toString()
377 377
     {
378
-        if($this->nTotalPages < 2)
378
+        if ($this->nTotalPages < 2)
379 379
         {
380 380
             return '';
381 381
         }
Please login to merge, or discard this patch.
src/Request/Call/Parameter.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -116,19 +116,19 @@  discard block
 block discarded – undo
116 116
      */
117 117
     public static function make($xValue): ParameterInterface
118 118
     {
119
-        if($xValue instanceof ParameterInterface)
119
+        if ($xValue instanceof ParameterInterface)
120 120
         {
121 121
             return $xValue;
122 122
         }
123
-        if(is_numeric($xValue))
123
+        if (is_numeric($xValue))
124 124
         {
125 125
             return new Parameter(self::NUMERIC_VALUE, $xValue);
126 126
         }
127
-        if(is_string($xValue))
127
+        if (is_string($xValue))
128 128
         {
129 129
             return new Parameter(self::QUOTED_VALUE, $xValue);
130 130
         }
131
-        if(is_bool($xValue))
131
+        if (is_bool($xValue))
132 132
         {
133 133
             return new Parameter(self::BOOL_VALUE, $xValue);
134 134
         }
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
      */
231 231
     protected function getNumericValueScript(): string
232 232
     {
233
-        return (string)$this->xValue;
233
+        return (string) $this->xValue;
234 234
     }
235 235
 
236 236
     /**
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
      */
241 241
     protected function getUnquotedValueScript(): string
242 242
     {
243
-        return (string)$this->xValue;
243
+        return (string) $this->xValue;
244 244
     }
245 245
 
246 246
     /**
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
      */
263 263
     protected function getPageNumberScript(): string
264 264
     {
265
-        return (string)$this->xValue;
265
+        return (string) $this->xValue;
266 266
     }
267 267
 
268 268
     /**
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
     public function getScript(): string
274 274
     {
275 275
         $sMethodName = 'get' . $this->sType . 'Script';
276
-        if(!method_exists($this, $sMethodName))
276
+        if (!method_exists($this, $sMethodName))
277 277
         {
278 278
             return '';
279 279
         }
Please login to merge, or discard this patch.
src/Request/Handler/Psr/PsrRequestHandler.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@
 block discarded – undo
72 72
         // and the other classes will get this request from there.
73 73
         $this->di->val(ServerRequestInterface::class, $request);
74 74
 
75
-        if(!$this->xRequestHandler->canProcessRequest())
75
+        if (!$this->xRequestHandler->canProcessRequest())
76 76
         {
77 77
             // Unable to find a plugin to process the request
78 78
             throw new RequestException($this->xTranslator->trans('errors.request.plugin'));
Please login to merge, or discard this patch.
src/Request/Handler/Psr/PsrAjaxMiddleware.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@
 block discarded – undo
64 64
         // and the other classes will get this request from there.
65 65
         $this->di->val(ServerRequestInterface::class, $request);
66 66
 
67
-        if(!$this->xRequestHandler->canProcessRequest())
67
+        if (!$this->xRequestHandler->canProcessRequest())
68 68
         {
69 69
             // Unable to find a plugin to process the request
70 70
             return $handler->handle($request);
Please login to merge, or discard this patch.
src/Request/Handler/CallbackManager.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@
 block discarded – undo
65 65
      */
66 66
     public function popBootCallbacks(): array
67 67
     {
68
-        if(empty($this->aBootCallbacks))
68
+        if (empty($this->aBootCallbacks))
69 69
         {
70 70
             return [];
71 71
         }
Please login to merge, or discard this patch.
src/Request/Handler/RequestHandler.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -300,8 +300,7 @@
 block discarded – undo
300 300
             $this->xResponseManager->error($e->getMessage());
301 301
             $this->onInvalid($e);
302 302
             throw $e;
303
-        }
304
-        catch(Exception $e)
303
+        } catch(Exception $e)
305 304
         {
306 305
             $this->xResponseManager->error($e->getMessage());
307 306
             $this->onError($e);
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -111,14 +111,14 @@  discard block
 block discarded – undo
111 111
     {
112 112
         $xTarget = $this->xRequestPlugin->getTarget();
113 113
         // Call the user defined callback
114
-        foreach($this->xCallbackManager->getBeforeCallbacks() as $xCallback)
114
+        foreach ($this->xCallbackManager->getBeforeCallbacks() as $xCallback)
115 115
         {
116 116
             $xReturn = call_user_func_array($xCallback, [$xTarget, &$bEndRequest]);
117
-            if($xReturn instanceof ResponseInterface)
117
+            if ($xReturn instanceof ResponseInterface)
118 118
             {
119 119
                 $this->xResponseManager->append($xReturn);
120 120
             }
121
-            if($bEndRequest)
121
+            if ($bEndRequest)
122 122
             {
123 123
                 return;
124 124
             }
@@ -133,11 +133,11 @@  discard block
 block discarded – undo
133 133
      */
134 134
     public function onAfter(bool $bEndRequest)
135 135
     {
136
-        foreach($this->xCallbackManager->getAfterCallbacks() as $xCallback)
136
+        foreach ($this->xCallbackManager->getAfterCallbacks() as $xCallback)
137 137
         {
138 138
             $xReturn = call_user_func_array($xCallback,
139 139
                 [$this->xRequestPlugin->getTarget(), $bEndRequest]);
140
-            if($xReturn instanceof ResponseInterface)
140
+            if ($xReturn instanceof ResponseInterface)
141 141
             {
142 142
                 $this->xResponseManager->append($xReturn);
143 143
             }
@@ -154,10 +154,10 @@  discard block
 block discarded – undo
154 154
      */
155 155
     public function onInvalid(RequestException $xException)
156 156
     {
157
-        foreach($this->xCallbackManager->getInvalidCallbacks() as $xCallback)
157
+        foreach ($this->xCallbackManager->getInvalidCallbacks() as $xCallback)
158 158
         {
159 159
             $xReturn = call_user_func($xCallback, $xException);
160
-            if($xReturn instanceof ResponseInterface)
160
+            if ($xReturn instanceof ResponseInterface)
161 161
             {
162 162
                 $this->xResponseManager->append($xReturn);
163 163
             }
@@ -174,10 +174,10 @@  discard block
 block discarded – undo
174 174
      */
175 175
     public function onError(Exception $xException)
176 176
     {
177
-        foreach($this->xCallbackManager->getErrorCallbacks() as $xCallback)
177
+        foreach ($this->xCallbackManager->getErrorCallbacks() as $xCallback)
178 178
         {
179 179
             $xReturn = call_user_func($xCallback, $xException);
180
-            if($xReturn instanceof ResponseInterface)
180
+            if ($xReturn instanceof ResponseInterface)
181 181
             {
182 182
                 $this->xResponseManager->append($xReturn);
183 183
             }
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
         $this->xUploadHandler = $this->di->getUploadHandler();
197 197
 
198 198
         // Return true if the request plugin was already found
199
-        if($this->xRequestPlugin !== null)
199
+        if ($this->xRequestPlugin !== null)
200 200
         {
201 201
             return true;
202 202
         }
@@ -204,9 +204,9 @@  discard block
 block discarded – undo
204 204
         // The HTTP request
205 205
         $xRequest = $this->di->getRequest();
206 206
         // Find a plugin to process the request
207
-        foreach($this->xPluginManager->getRequestHandlers() as $sClassName)
207
+        foreach ($this->xPluginManager->getRequestHandlers() as $sClassName)
208 208
         {
209
-            if($sClassName::canProcessRequest($xRequest))
209
+            if ($sClassName::canProcessRequest($xRequest))
210 210
             {
211 211
                 $this->xRequestPlugin = $this->di->g($sClassName);
212 212
                 $this->xRequestPlugin->setTarget($xRequest);
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
         }
216 216
 
217 217
         // Check if the upload plugin is enabled
218
-        if($this->xUploadHandler === null)
218
+        if ($this->xUploadHandler === null)
219 219
         {
220 220
             return false;
221 221
         }
@@ -237,15 +237,15 @@  discard block
 block discarded – undo
237 237
         // The HTTP request
238 238
         $xRequest = $this->di->getRequest();
239 239
         // Process uploaded files, if the upload plugin is enabled
240
-        if($this->xUploadHandler !== null && $this->xUploadHandler->canProcessRequest($xRequest))
240
+        if ($this->xUploadHandler !== null && $this->xUploadHandler->canProcessRequest($xRequest))
241 241
         {
242 242
             $this->xUploadHandler->processRequest($xRequest);
243 243
         }
244 244
         // Process the request
245
-        if(($this->xRequestPlugin))
245
+        if (($this->xRequestPlugin))
246 246
         {
247 247
             $xResponse = $this->xRequestPlugin->processRequest();
248
-            if(($xResponse))
248
+            if (($xResponse))
249 249
             {
250 250
                 $this->xResponseManager->append($xResponse);
251 251
             }
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
     public function processRequest()
267 267
     {
268 268
         // Check if there is a plugin to process this request
269
-        if(!$this->canProcessRequest())
269
+        if (!$this->canProcessRequest())
270 270
         {
271 271
             return;
272 272
         }
@@ -275,11 +275,11 @@  discard block
 block discarded – undo
275 275
         {
276 276
             $bEndRequest = false;
277 277
             // Handle before processing event
278
-            if(($this->xRequestPlugin))
278
+            if (($this->xRequestPlugin))
279 279
             {
280 280
                 $this->onBefore($bEndRequest);
281 281
             }
282
-            if($bEndRequest)
282
+            if ($bEndRequest)
283 283
             {
284 284
                 return;
285 285
             }
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
             $this->_processRequest();
288 288
 
289 289
             // Handle after processing event
290
-            if(($this->xRequestPlugin))
290
+            if (($this->xRequestPlugin))
291 291
             {
292 292
                 $this->onAfter($bEndRequest);
293 293
             }
@@ -295,13 +295,13 @@  discard block
 block discarded – undo
295 295
         // An exception was thrown while processing the request.
296 296
         // The request missed the corresponding handler function,
297 297
         // or an error occurred while attempting to execute the handler.
298
-        catch(RequestException $e)
298
+        catch (RequestException $e)
299 299
         {
300 300
             $this->xResponseManager->error($e->getMessage());
301 301
             $this->onInvalid($e);
302 302
             throw $e;
303 303
         }
304
-        catch(Exception $e)
304
+        catch (Exception $e)
305 305
         {
306 306
             $this->xResponseManager->error($e->getMessage());
307 307
             $this->onError($e);
Please login to merge, or discard this patch.
src/Request/Handler/ParameterReader.php 3 patches
Switch Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -196,19 +196,19 @@
 block discarded – undo
196 196
         $sValue = substr($sValue, 1);
197 197
         switch($cType)
198 198
         {
199
-        case 'S':
200
-            $value = !$sValue ? '' : $sValue;
201
-            break;
202
-        case 'B':
203
-            $value = $this->convertStringToBool($sValue);
204
-            break;
205
-        case 'N':
206
-            $value = ($sValue == floor($sValue) ? (int)$sValue : (float)$sValue);
207
-            break;
208
-        case '*':
209
-        default:
210
-            $value = null;
211
-            break;
199
+            case 'S':
200
+                $value = !$sValue ? '' : $sValue;
201
+                break;
202
+            case 'B':
203
+                $value = $this->convertStringToBool($sValue);
204
+                break;
205
+            case 'N':
206
+                $value = ($sValue == floor($sValue) ? (int)$sValue : (float)$sValue);
207
+                break;
208
+            case '*':
209
+            default:
210
+                $value = null;
211
+                break;
212 212
         }
213 213
         return $value;
214 214
     }
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -107,16 +107,16 @@  discard block
 block discarded – undo
107 107
         // Parameters are url encoded when uploading files
108 108
         $aServerParams = $this->di->getRequest()->getServerParams();
109 109
         $sContentType = '';
110
-        if(isset($aServerParams['CONTENT_TYPE']))
110
+        if (isset($aServerParams['CONTENT_TYPE']))
111 111
         {
112 112
             $sContentType = $aServerParams['CONTENT_TYPE'];
113 113
         }
114
-        elseif(isset($aServerParams['HTTP_CONTENT_TYPE']))
114
+        elseif (isset($aServerParams['HTTP_CONTENT_TYPE']))
115 115
         {
116 116
             $sContentType = $aServerParams['HTTP_CONTENT_TYPE'];
117 117
         }
118 118
         $sType = 'multipart/form-data';
119
-        if(strncmp($sContentType, $sType, strlen($sType)) !== 0)
119
+        if (strncmp($sContentType, $sType, strlen($sType)) !== 0)
120 120
         {
121 121
             $this->cParamDecoder = function($sParam) { return $sParam; };
122 122
             return;
@@ -137,19 +137,19 @@  discard block
 block discarded – undo
137 137
             return $sStr;
138 138
         };
139 139
         $sEncoding = $this->xConfigManager->getOption('core.encoding', '');
140
-        if(function_exists('iconv'))
140
+        if (function_exists('iconv'))
141 141
         {
142 142
             $this->cUtf8Decoder = function($sStr) use($sEncoding) {
143 143
                 return iconv("UTF-8", $sEncoding . '//TRANSLIT', $sStr);
144 144
             };
145 145
         }
146
-        elseif(function_exists('mb_convert_encoding'))
146
+        elseif (function_exists('mb_convert_encoding'))
147 147
         {
148 148
             $this->cUtf8Decoder = function($sStr) use($sEncoding) {
149 149
                 return mb_convert_encoding($sStr, $sEncoding, "UTF-8");
150 150
             };
151 151
         }
152
-        elseif($sEncoding === "ISO-8859-1")
152
+        elseif ($sEncoding === "ISO-8859-1")
153 153
         {
154 154
             $this->cUtf8Decoder = function($sStr) {
155 155
                 return utf8_decode($sStr);
@@ -170,11 +170,11 @@  discard block
 block discarded – undo
170 170
      */
171 171
     private function convertStringToBool(string $sValue): bool
172 172
     {
173
-        if(strcasecmp($sValue, 'true') === 0)
173
+        if (strcasecmp($sValue, 'true') === 0)
174 174
         {
175 175
             return true;
176 176
         }
177
-        if(strcasecmp($sValue, 'false') === 0)
177
+        if (strcasecmp($sValue, 'false') === 0)
178 178
         {
179 179
             return false;
180 180
         }
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
     {
195 195
         $cType = substr($sValue, 0, 1);
196 196
         $sValue = substr($sValue, 1);
197
-        switch($cType)
197
+        switch ($cType)
198 198
         {
199 199
         case 'S':
200 200
             $value = !$sValue ? '' : $sValue;
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
             $value = $this->convertStringToBool($sValue);
204 204
             break;
205 205
         case 'N':
206
-            $value = ($sValue == floor($sValue) ? (int)$sValue : (float)$sValue);
206
+            $value = ($sValue == floor($sValue) ? (int) $sValue : (float) $sValue);
207 207
             break;
208 208
         case '*':
209 209
         default:
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
      */
223 223
     private function decodeRequestParameter(string $sParam)
224 224
     {
225
-        if($sParam === '')
225
+        if ($sParam === '')
226 226
         {
227 227
             return $sParam;
228 228
         }
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
         $sParam = call_user_func($this->cParamDecoder, $sParam);
231 231
 
232 232
         $xJson = json_decode($sParam, true);
233
-        if($xJson !== null && $sParam != $xJson)
233
+        if ($xJson !== null && $sParam != $xJson)
234 234
         {
235 235
             return $xJson;
236 236
         }
@@ -245,9 +245,9 @@  discard block
 block discarded – undo
245 245
         $aParams = [];
246 246
         $xRequest = $this->di->getRequest();
247 247
         $aBody = $xRequest->getParsedBody();
248
-        if(is_array($aBody))
248
+        if (is_array($aBody))
249 249
         {
250
-            if(isset($aBody['jxnargs']))
250
+            if (isset($aBody['jxnargs']))
251 251
             {
252 252
                 $aParams = $aBody['jxnargs'];
253 253
             }
@@ -255,13 +255,13 @@  discard block
 block discarded – undo
255 255
         else
256 256
         {
257 257
             $aParams = $xRequest->getQueryParams();
258
-            if(isset($aParams['jxnargs']))
258
+            if (isset($aParams['jxnargs']))
259 259
             {
260 260
                 $aParams = $aParams['jxnargs'];
261 261
             }
262 262
         }
263 263
         return array_map(function($sParam) {
264
-            return $this->decodeRequestParameter((string)$sParam);
264
+            return $this->decodeRequestParameter((string) $sParam);
265 265
         }, $aParams);
266 266
     }
267 267
 
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
      */
275 275
     private function decodeUtf8Parameter($xValue)
276 276
     {
277
-        if(is_string($xValue))
277
+        if (is_string($xValue))
278 278
         {
279 279
             return call_user_func($this->cUtf8Decoder, $xValue);
280 280
         }
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
     private function decodeUtf8Parameters(array $aParams): array
295 295
     {
296 296
         $aValues = [];
297
-        foreach($aParams as $sKey => $xValue)
297
+        foreach ($aParams as $sKey => $xValue)
298 298
         {
299 299
             // Decode the key
300 300
             $sKey = call_user_func($this->cUtf8Decoder, $sKey);
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
     {
316 316
         $this->setParamDecoder();
317 317
         $aParams = $this->getRequestParameters();
318
-        if(!$this->xConfigManager->getOption('core.decode_utf8'))
318
+        if (!$this->xConfigManager->getOption('core.decode_utf8'))
319 319
         {
320 320
             return $aParams;
321 321
         }
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -110,8 +110,7 @@  discard block
 block discarded – undo
110 110
         if(isset($aServerParams['CONTENT_TYPE']))
111 111
         {
112 112
             $sContentType = $aServerParams['CONTENT_TYPE'];
113
-        }
114
-        elseif(isset($aServerParams['HTTP_CONTENT_TYPE']))
113
+        } elseif(isset($aServerParams['HTTP_CONTENT_TYPE']))
115 114
         {
116 115
             $sContentType = $aServerParams['HTTP_CONTENT_TYPE'];
117 116
         }
@@ -142,20 +141,17 @@  discard block
 block discarded – undo
142 141
             $this->cUtf8Decoder = function($sStr) use($sEncoding) {
143 142
                 return iconv("UTF-8", $sEncoding . '//TRANSLIT', $sStr);
144 143
             };
145
-        }
146
-        elseif(function_exists('mb_convert_encoding'))
144
+        } elseif(function_exists('mb_convert_encoding'))
147 145
         {
148 146
             $this->cUtf8Decoder = function($sStr) use($sEncoding) {
149 147
                 return mb_convert_encoding($sStr, $sEncoding, "UTF-8");
150 148
             };
151
-        }
152
-        elseif($sEncoding === "ISO-8859-1")
149
+        } elseif($sEncoding === "ISO-8859-1")
153 150
         {
154 151
             $this->cUtf8Decoder = function($sStr) {
155 152
                 return utf8_decode($sStr);
156 153
             };
157
-        }
158
-        else
154
+        } else
159 155
         {
160 156
             throw new RequestException($this->xTranslator->trans('errors.request.conversion'));
161 157
         }
@@ -251,8 +247,7 @@  discard block
 block discarded – undo
251 247
             {
252 248
                 $aParams = $aBody['jxnargs'];
253 249
             }
254
-        }
255
-        else
250
+        } else
256 251
         {
257 252
             $aParams = $xRequest->getQueryParams();
258 253
             if(isset($aParams['jxnargs']))
Please login to merge, or discard this patch.
src/Response/Response.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
      */
89 89
     public function getOutput(): string
90 90
     {
91
-        if($this->getCommandCount() === 0)
91
+        if ($this->getCommandCount() === 0)
92 92
         {
93 93
             return '';
94 94
         }
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
      */
148 148
     public function bag(string $sName): DataBagContext
149 149
     {
150
-        return $this->plugin('bags')->bag($sName);;
150
+        return $this->plugin('bags')->bag($sName); ;
151 151
     }
152 152
 
153 153
     /**
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
     public function addCommand(array $aAttributes, $mData): Response
162 162
     {
163 163
         $aAttributes = array_map(function($xAttribute) {
164
-            return is_integer($xAttribute) ? $xAttribute : trim((string)$xAttribute, " \t");
164
+            return is_integer($xAttribute) ? $xAttribute : trim((string) $xAttribute, " \t");
165 165
         }, $aAttributes);
166 166
         $aAttributes['data'] = $mData;
167 167
         $this->aCommands[] = $aAttributes;
@@ -181,9 +181,9 @@  discard block
 block discarded – undo
181 181
     protected function _addCommand(string $sName, array $aAttributes, $mData, bool $bRemoveEmpty = false): Response
182 182
     {
183 183
         $mData = is_array($mData) ? array_map(function($sData) {
184
-            return trim((string)$sData, " \t\n");
185
-        }, $mData) : trim((string)$mData, " \t\n");
186
-        if($bRemoveEmpty)
184
+            return trim((string) $sData, " \t\n");
185
+        }, $mData) : trim((string) $mData, " \t\n");
186
+        if ($bRemoveEmpty)
187 187
         {
188 188
             $aAttributes = array_filter($aAttributes, function($xValue) {
189 189
                 return $xValue === '';
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
     public function toPsr(): PsrResponseInterface
217 217
     {
218 218
         $xPsrResponse = $this->xPsr17Factory->createResponse(200);
219
-        if($this->di->getRequest()->getMethod() === 'GET')
219
+        if ($this->di->getRequest()->getMethod() === 'GET')
220 220
         {
221 221
             $xPsrResponse = $xPsrResponse
222 222
                 ->withHeader('Expires', 'Mon, 26 Jul 1997 05:00:00 GMT')
Please login to merge, or discard this patch.