Passed
Branch main (b9eaa8)
by Thierry
03:26
created
src/Di/Container.php 3 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -193,8 +193,7 @@
 block discarded – undo
193 193
                 return $this->xAppContainer->get($sClass);
194 194
             }
195 195
             return $this->xLibContainer->offsetGet($sClass);
196
-        }
197
-        catch(Exception|Throwable $e)
196
+        } catch(Exception|Throwable $e)
198 197
         {
199 198
             $xLogger = $this->g(LoggerInterface::class);
200 199
             $xTranslator = $this->g(Translator::class);
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -234,7 +234,7 @@
 block discarded – undo
234 234
      */
235 235
     public function val(string $sKey, $xValue)
236 236
     {
237
-       $this->xLibContainer->offsetSet($sKey, $xValue);
237
+        $this->xLibContainer->offsetSet($sKey, $xValue);
238 238
     }
239 239
 
240 240
     /**
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
      */
159 159
     public function has(string $sClass): bool
160 160
     {
161
-        if($this->xAppContainer != null && $this->xAppContainer->has($sClass))
161
+        if ($this->xAppContainer != null && $this->xAppContainer->has($sClass))
162 162
         {
163 163
             return true;
164 164
         }
@@ -189,13 +189,13 @@  discard block
 block discarded – undo
189 189
     {
190 190
         try
191 191
         {
192
-            if($this->xAppContainer != null && $this->xAppContainer->has($sClass))
192
+            if ($this->xAppContainer != null && $this->xAppContainer->has($sClass))
193 193
             {
194 194
                 return $this->xAppContainer->get($sClass);
195 195
             }
196 196
             return $this->xLibContainer->offsetGet($sClass);
197 197
         }
198
-        catch(Exception|Throwable $e)
198
+        catch (Exception | Throwable $e)
199 199
         {
200 200
             $xLogger = $this->g(LoggerInterface::class);
201 201
             $xTranslator = $this->g(Translator::class);
@@ -263,15 +263,15 @@  discard block
 block discarded – undo
263 263
     {
264 264
         $xType = $xParameter->getType();
265 265
         // Check the parameter class first.
266
-        if($xType instanceof ReflectionNamedType)
266
+        if ($xType instanceof ReflectionNamedType)
267 267
         {
268 268
             // Check the class + the name
269
-            if($this->has($xType->getName() . ' $' . $xParameter->getName()))
269
+            if ($this->has($xType->getName() . ' $' . $xParameter->getName()))
270 270
             {
271 271
                 return $this->get($xType->getName() . ' $' . $xParameter->getName());
272 272
             }
273 273
             // Check the class only
274
-            if($this->has($xType->getName()))
274
+            if ($this->has($xType->getName()))
275 275
             {
276 276
                 return $this->get($xType->getName());
277 277
             }
@@ -291,16 +291,16 @@  discard block
 block discarded – undo
291 291
      */
292 292
     public function make($xClass)
293 293
     {
294
-        if(is_string($xClass))
294
+        if (is_string($xClass))
295 295
         {
296 296
             $xClass = new ReflectionClass($xClass); // Create the reflection class instance
297 297
         }
298
-        if(!($xClass instanceof ReflectionClass))
298
+        if (!($xClass instanceof ReflectionClass))
299 299
         {
300 300
             return null;
301 301
         }
302 302
         // Use the Reflection class to get the parameters of the constructor
303
-        if(($constructor = $xClass->getConstructor()) === null)
303
+        if (($constructor = $xClass->getConstructor()) === null)
304 304
         {
305 305
             return $xClass->newInstance();
306 306
         }
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
@@ -211,8 +211,7 @@
 block discarded – undo
211 211
         {
212 212
             $this->xResponseManager->error($e->getMessage());
213 213
             $this->xCallbackManager->onInvalid($e);
214
-        }
215
-        catch(Exception $e)
214
+        } catch(Exception $e)
216 215
         {
217 216
             $this->xResponseManager->error($e->getMessage());
218 217
             $this->xCallbackManager->onError($e);
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
         $this->xUploadHandler = $this->di->getUploadHandler();
108 108
 
109 109
         // Return true if the request plugin was already found
110
-        if($this->xRequestPlugin !== null)
110
+        if ($this->xRequestPlugin !== null)
111 111
         {
112 112
             return true;
113 113
         }
@@ -115,9 +115,9 @@  discard block
 block discarded – undo
115 115
         // The HTTP request
116 116
         $xRequest = $this->di->getRequest();
117 117
         // Find a plugin to process the request
118
-        foreach($this->xPluginManager->getRequestHandlers() as $sClassName)
118
+        foreach ($this->xPluginManager->getRequestHandlers() as $sClassName)
119 119
         {
120
-            if($sClassName::canProcessRequest($xRequest))
120
+            if ($sClassName::canProcessRequest($xRequest))
121 121
             {
122 122
                 $this->xRequestPlugin = $this->di->g($sClassName);
123 123
                 $this->xRequestPlugin->setTarget($xRequest);
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
         }
127 127
 
128 128
         // Check if the upload plugin is enabled
129
-        if($this->xUploadHandler === null)
129
+        if ($this->xUploadHandler === null)
130 130
         {
131 131
             return false;
132 132
         }
@@ -148,15 +148,15 @@  discard block
 block discarded – undo
148 148
         // The HTTP request
149 149
         $xRequest = $this->di->getRequest();
150 150
         // Process uploaded files, if the upload plugin is enabled
151
-        if($this->xUploadHandler !== null && $this->xUploadHandler->canProcessRequest($xRequest))
151
+        if ($this->xUploadHandler !== null && $this->xUploadHandler->canProcessRequest($xRequest))
152 152
         {
153 153
             $this->xUploadHandler->processRequest($xRequest);
154 154
         }
155 155
         // Process the request
156
-        if(($this->xRequestPlugin))
156
+        if (($this->xRequestPlugin))
157 157
         {
158 158
             $xResponse = $this->xRequestPlugin->processRequest();
159
-            if(($xResponse))
159
+            if (($xResponse))
160 160
             {
161 161
                 $this->xResponseManager->setResponse($xResponse);
162 162
             }
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
     public function processRequest()
178 178
     {
179 179
         // Check if there is a plugin to process this request
180
-        if(!$this->canProcessRequest())
180
+        if (!$this->canProcessRequest())
181 181
         {
182 182
             return;
183 183
         }
@@ -186,11 +186,11 @@  discard block
 block discarded – undo
186 186
         {
187 187
             $bEndRequest = false;
188 188
             // Handle before processing event
189
-            if(($this->xRequestPlugin))
189
+            if (($this->xRequestPlugin))
190 190
             {
191 191
                 $this->xCallbackManager->onBefore($this->xRequestPlugin->getTarget(), $bEndRequest);
192 192
             }
193
-            if($bEndRequest)
193
+            if ($bEndRequest)
194 194
             {
195 195
                 return;
196 196
             }
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
             $this->_processRequest();
199 199
 
200 200
             // Handle after processing event
201
-            if(($this->xRequestPlugin))
201
+            if (($this->xRequestPlugin))
202 202
             {
203 203
                 $this->xCallbackManager->onAfter($this->xRequestPlugin->getTarget(), $bEndRequest);
204 204
             }
@@ -206,12 +206,12 @@  discard block
 block discarded – undo
206 206
         // An exception was thrown while processing the request.
207 207
         // The request missed the corresponding handler function,
208 208
         // or an error occurred while attempting to execute the handler.
209
-        catch(RequestException $e)
209
+        catch (RequestException $e)
210 210
         {
211 211
             $this->xResponseManager->error($e->getMessage());
212 212
             $this->xCallbackManager->onInvalid($e);
213 213
         }
214
-        catch(Exception $e)
214
+        catch (Exception $e)
215 215
         {
216 216
             $this->xResponseManager->error($e->getMessage());
217 217
             $this->xCallbackManager->onError($e);
Please login to merge, or discard this patch.
src/Plugin/Request/CallableClass/CallableDirPlugin.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
     private function checkDirectory(string $sDirectory): string
81 81
     {
82 82
         $sDirectory = rtrim(trim($sDirectory), '/\\');
83
-        if(!is_dir($sDirectory))
83
+        if (!is_dir($sDirectory))
84 84
         {
85 85
             throw new SetupException($this->xTranslator->trans('errors.objects.invalid-declaration'));
86 86
         }
@@ -93,11 +93,11 @@  discard block
 block discarded – undo
93 93
      */
94 94
     public function checkOptions(string $sCallable, $xOptions): array
95 95
     {
96
-        if(is_string($xOptions))
96
+        if (is_string($xOptions))
97 97
         {
98 98
             $xOptions = ['namespace' => $xOptions];
99 99
         }
100
-        if(!is_array($xOptions))
100
+        if (!is_array($xOptions))
101 101
         {
102 102
             throw new SetupException($this->xTranslator->trans('errors.objects.invalid-declaration'));
103 103
         }
@@ -105,14 +105,14 @@  discard block
 block discarded – undo
105 105
         $xOptions['directory'] = $this->checkDirectory($sCallable);
106 106
         // Check the namespace
107 107
         $sNamespace = $xOptions['namespace'] ?? '';
108
-        if(!($xOptions['namespace'] = trim($sNamespace, ' \\')))
108
+        if (!($xOptions['namespace'] = trim($sNamespace, ' \\')))
109 109
         {
110 110
             $xOptions['namespace'] = '';
111 111
         }
112 112
 
113 113
         // Change the keys in $xOptions to have "\" as separator
114 114
         $_aOptions = [];
115
-        foreach($xOptions as $sName => $aOption)
115
+        foreach ($xOptions as $sName => $aOption)
116 116
         {
117 117
             $sName = trim(str_replace('.', '\\', $sName), ' \\');
118 118
             $_aOptions[$sName] = $aOption;
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
      */
126 126
     public function register(string $sType, string $sCallable, array $aOptions): bool
127 127
     {
128
-        if(($aOptions['namespace']))
128
+        if (($aOptions['namespace']))
129 129
         {
130 130
             $this->xRegistry->addNamespace($aOptions['namespace'], $aOptions);
131 131
             return true;
Please login to merge, or discard this patch.
templates/callables/object.js.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2,18 +2,18 @@
 block discarded – undo
2 2
 <?php
3 3
 // An exported PHP class can have the same name as a subdir in the same parent dir.
4 4
 // So, we must make sure that embedded js objects do not already exist, before we create them.
5
-if(strpos($sJsClass, '.') !== false): ?>
5
+if (strpos($sJsClass, '.') !== false): ?>
6 6
 if(<?php echo $sJsClass ?> === undefined) {
7 7
     <?php echo $sJsClass ?> = {};
8 8
 }
9 9
 <?php else: ?>
10 10
 <?php echo $sJsClass ?> = {};
11 11
 <?php endif ?>
12
-<?php foreach($this->aMethods as $aMethod): ?>
12
+<?php foreach ($this->aMethods as $aMethod): ?>
13 13
 <?php echo $sJsClass ?>.<?php echo $aMethod['name'] ?> = function() {
14 14
     return jaxon.request({ jxncls: '<?php echo $this->sClass ?>', jxnmthd: '<?php
15 15
         echo $aMethod['name'] ?>' }, { parameters: arguments<?php
16
-        foreach($aMethod['config'] as $sKey => $sValue): ?>, <?php
16
+        foreach ($aMethod['config'] as $sKey => $sValue): ?>, <?php
17 17
         echo $sKey ?>: <?php echo $sValue ?><?php endforeach ?> });
18 18
 };
19 19
 <?php endforeach;
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,8 @@  discard block
 block discarded – undo
6 6
 if(<?php echo $sJsClass ?> === undefined) {
7 7
     <?php echo $sJsClass ?> = {};
8 8
 }
9
-<?php else: ?>
9
+<?php else {
10
+    : ?>
10 11
 <?php echo $sJsClass ?> = {};
11 12
 <?php endif ?>
12 13
 <?php foreach($this->aMethods as $aMethod): ?>
@@ -17,3 +18,4 @@  discard block
 block discarded – undo
17 18
         echo $sKey ?>: <?php echo $sValue ?><?php endforeach ?> });
18 19
 };
19 20
 <?php endforeach;
21
+}
Please login to merge, or discard this patch.
src/Script/AbstractJsCall.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@
 block discarded – undo
60 60
      */
61 61
     public function __get(string $sAttribute): JsExpr
62 62
     {
63
-        return $this->_expr()->__get( $sAttribute);
63
+        return $this->_expr()->__get($sAttribute);
64 64
     }
65 65
 
66 66
     /**
Please login to merge, or discard this patch.
src/Script/JxnCall.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
  * @link https://github.com/jaxon-php/jaxon-core
15 15
  */
16 16
 
17
- use Jaxon\App\Dialog\DialogManager;
17
+    use Jaxon\App\Dialog\DialogManager;
18 18
 
19 19
 class JxnCall extends AbstractCall
20 20
 {
Please login to merge, or discard this patch.
src/Script/JsExpr.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -91,9 +91,9 @@  discard block
 block discarded – undo
91 91
      */
92 92
     public function func(): ?Func
93 93
     {
94
-        foreach($this->aCalls as $xCall)
94
+        foreach ($this->aCalls as $xCall)
95 95
         {
96
-            if(is_a($xCall, Func::class))
96
+            if (is_a($xCall, Func::class))
97 97
             {
98 98
                 return $xCall;
99 99
             }
@@ -442,21 +442,21 @@  discard block
 block discarded – undo
442 442
         $aCalls = array_map(function(JsonSerializable $xCall) {
443 443
             return $xCall->jsonSerialize();
444 444
         }, $this->aCalls);
445
-        if($this->bToInt)
445
+        if ($this->bToInt)
446 446
         {
447 447
             $aCalls[] = $this->toIntCall();
448 448
         }
449 449
 
450 450
         $aJsExpr = ['_type' => $this->getType(), 'calls' => $aCalls];
451
-        if(($this->aConfirm))
451
+        if (($this->aConfirm))
452 452
         {
453 453
             $aJsExpr['question'] = $this->aConfirm;
454 454
         }
455
-        if(($this->aCondition))
455
+        if (($this->aCondition))
456 456
         {
457 457
             $aJsExpr['condition'] = $this->aCondition;
458 458
         }
459
-        if(($this->aMessage))
459
+        if (($this->aMessage))
460 460
         {
461 461
             $aJsExpr['message'] = $this->aMessage;
462 462
         }
Please login to merge, or discard this patch.
src/Script/Call/Selector.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
     {
32 32
         $sName = trim($sPath) ?: 'this';
33 33
         $this->aCall = ['_type' => 'select', '_name' => $sName, 'mode' => $sMode];
34
-        if(($sPath) && ($xContext))
34
+        if (($sPath) && ($xContext))
35 35
         {
36 36
             $this->aCall['context'] = is_a($xContext, JsonSerializable::class) ?
37 37
                 $xContext->jsonSerialize() : $xContext;
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
      */
52 52
     private function getPathAsStr(string $sPath, string $sMode, $xContext)
53 53
     {
54
-        if(!$xContext)
54
+        if (!$xContext)
55 55
         {
56 56
             return $sMode === 'jq' ? "jaxon.jq('$sPath')" : $sPath;
57 57
         }
Please login to merge, or discard this patch.
src/Script/Call/Attr.php 1 patch
Spacing   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
      */
67 67
     public function jsonSerialize(): array
68 68
     {
69
-        if(isset($this->aValue['value']))
69
+        if (isset($this->aValue['value']))
70 70
         {
71 71
             $this->aValue['value'] = $this->aValue['value']->jsonSerialize();
72 72
         }
@@ -80,7 +80,6 @@  discard block
 block discarded – undo
80 80
      */
81 81
     public function __toString(): string
82 82
     {
83
-        return !isset($this->aValue['value']) ? $this->aValue['_name'] :
84
-            $this->aValue['_name'] . ' = ' . $this->aValue['value']->__toString();
83
+        return !isset($this->aValue['value']) ? $this->aValue['_name'] : $this->aValue['_name'] . ' = ' . $this->aValue['value']->__toString();
85 84
     }
86 85
 }
Please login to merge, or discard this patch.