Passed
Push — main ( 273db0...683317 )
by Thierry
03:54
created
jaxon-core/templates/callables/objects.js.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
   rc: (name, method, parameters, options = {}) => jaxon.request({ type: 'class', name, method }, { parameters, ...options}),
3 3
   rf: (name, parameters, options = {}) => jaxon.request({ type: 'func', name }, { parameters, ...options}),
4 4
 <?php
5
-foreach($this->aCallableNames as $nIndex => $sName):
5
+foreach ($this->aCallableNames as $nIndex => $sName):
6 6
   echo "  c$nIndex: '$sName',\n";
7 7
 endforeach
8 8
 ?>
Please login to merge, or discard this patch.
jaxon-core/templates/plugins/config.js.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -6,24 +6,24 @@
 block discarded – undo
6 6
 jaxon.config.defaultMethod = '<?php echo $this->sDefaultMethod ?>';
7 7
 jaxon.config.responseType = '<?php echo $this->sResponseType ?>';
8 8
 
9
-<?php if($this->nResponseQueueSize > 0): ?>
9
+<?php if ($this->nResponseQueueSize > 0): ?>
10 10
 jaxon.config.responseQueueSize = <?php echo $this->nResponseQueueSize ?>;
11 11
 <?php endif ?>
12 12
 
13
-<?php if($this->bLoggingEnabled): ?>
13
+<?php if ($this->bLoggingEnabled): ?>
14 14
 jaxon.debug.logger = '<?php echo Jaxon\rq(Jaxon\App\Component\Logger::class)->_class() ?>';
15 15
 <?php endif ?>
16 16
 
17
-<?php if($this->bDebug): ?>
17
+<?php if ($this->bDebug): ?>
18 18
 jaxon.debug.active = true;
19
-<?php if($this->sDebugOutputID): ?>
19
+<?php if ($this->sDebugOutputID): ?>
20 20
 jaxon.debug.outputID = '<?php echo $this->sDebugOutputID ?>';
21 21
 <?php endif ?>
22
-<?php if($this->bVerboseDebug): ?>
22
+<?php if ($this->bVerboseDebug): ?>
23 23
 jaxon.debug.verbose.active = true;
24 24
 <?php endif ?>
25 25
 <?php endif ?>
26 26
 
27
-<?php if($this->sCsrfMetaName): ?>
27
+<?php if ($this->sCsrfMetaName): ?>
28 28
 jaxon.setCsrf('<?php echo $this->sCsrfMetaName ?>');
29 29
 <?php endif ?>
Please login to merge, or discard this patch.
jaxon-core/src/Plugin/Request/CallableClass/CallableClassPlugin.php 1 patch
Spacing   +15 added lines, -17 removed lines patch added patch discarded remove patch
@@ -87,15 +87,15 @@  discard block
 block discarded – undo
87 87
      */
88 88
     public function checkOptions(string $sCallable, $xOptions): array
89 89
     {
90
-        if(!$this->xValidator->validateClass(trim($sCallable)))
90
+        if (!$this->xValidator->validateClass(trim($sCallable)))
91 91
         {
92 92
             throw new SetupException($this->xTranslator->trans('errors.objects.invalid-declaration'));
93 93
         }
94
-        if(is_string($xOptions))
94
+        if (is_string($xOptions))
95 95
         {
96 96
             $xOptions = ['include' => $xOptions];
97 97
         }
98
-        elseif(!is_array($xOptions))
98
+        elseif (!is_array($xOptions))
99 99
         {
100 100
             throw new SetupException($this->xTranslator->trans('errors.objects.invalid-declaration'));
101 101
         }
@@ -140,16 +140,16 @@  discard block
 block discarded – undo
140 140
     private function addCallable(CallableObject $xCallableObject): void
141 141
     {
142 142
         $aCallableMethods = $xCallableObject->getCallableMethods();
143
-        if($xCallableObject->excluded() || count($aCallableMethods) === 0)
143
+        if ($xCallableObject->excluded() || count($aCallableMethods) === 0)
144 144
         {
145 145
             return;
146 146
         }
147 147
 
148 148
         $aCallableObject = &$this->aCallableObjects;
149 149
         $sJsName = $xCallableObject->getJsName();
150
-        foreach(explode('.', $sJsName) as $sName)
150
+        foreach (explode('.', $sJsName) as $sName)
151 151
         {
152
-            if(!isset($aCallableObject['children'][$sName]))
152
+            if (!isset($aCallableObject['children'][$sName]))
153 153
             {
154 154
                 $aCallableObject['children'][$sName] = [];
155 155
             }
@@ -170,12 +170,11 @@  discard block
 block discarded – undo
170 170
     private function renderMethod(string $sIndent, array $aTemplateVars): string
171 171
     {
172 172
         $aOptions = [];
173
-        foreach($aTemplateVars['aMethod']['options'] as $sKey => $sValue)
173
+        foreach ($aTemplateVars['aMethod']['options'] as $sKey => $sValue)
174 174
         {
175 175
             $aOptions[] = "$sKey: $sValue";
176 176
         }
177
-        $aTemplateVars['sArguments'] = count($aOptions) === 0 ? 'args' :
178
-            'args, { ' . implode(', ', $aOptions) . ' }';
177
+        $aTemplateVars['sArguments'] = count($aOptions) === 0 ? 'args' : 'args, { ' . implode(', ', $aOptions) . ' }';
179 178
 
180 179
         return $sIndent . trim($this->xTemplateEngine
181 180
             ->render('jaxon::callables/method.js', $aTemplateVars));
@@ -197,11 +196,10 @@  discard block
 block discarded – undo
197 196
             'aMethod' => $aMethod,
198 197
             'nIndex' => $aCallable['index'] ?? 0,
199 198
         ]);
200
-        $aMethods = !isset($aCallable['methods']) ? [] :
201
-            array_map($fMethodCallback, $aCallable['methods']);
199
+        $aMethods = !isset($aCallable['methods']) ? [] : array_map($fMethodCallback, $aCallable['methods']);
202 200
 
203 201
         $aChildren = [];
204
-        foreach($aCallable['children'] ?? [] as $sName => $aChild)
202
+        foreach ($aCallable['children'] ?? [] as $sName => $aChild)
205 203
         {
206 204
             $aChildren[] = $this->renderChild("$sName:", "$sJsClass.$sName",
207 205
                 $aChild, $nIndent) . ',';
@@ -243,7 +241,7 @@  discard block
 block discarded – undo
243 241
 
244 242
         $this->aCallableNames = [];
245 243
         $this->aCallableObjects = ['children' => []];
246
-        foreach($this->cdi->getCallableObjects() as $xCallableObject)
244
+        foreach ($this->cdi->getCallableObjects() as $xCallableObject)
247 245
         {
248 246
             $this->addCallable($xCallableObject);
249 247
         }
@@ -253,7 +251,7 @@  discard block
 block discarded – undo
253 251
                 'aCallableNames' => $this->aCallableNames,
254 252
             ])
255 253
         ];
256
-        foreach($this->aCallableObjects['children'] as $sJsClass => $aCallable)
254
+        foreach ($this->aCallableObjects['children'] as $sJsClass => $aCallable)
257 255
         {
258 256
             $aScripts[] = $this->renderChild("{$this->sPrefix}$sJsClass =",
259 257
                 $sJsClass, $aCallable) . ';';
@@ -309,7 +307,7 @@  discard block
 block discarded – undo
309 307
         // Will be used to print a translated error message.
310 308
         $aErrorParams = ['class' => $sClassName, 'method' => $sMethodName];
311 309
 
312
-        if(!$this->xValidator->validateJsObject($sClassName) ||
310
+        if (!$this->xValidator->validateJsObject($sClassName) ||
313 311
             !$this->xValidator->validateMethod($sMethodName))
314 312
         {
315 313
             // Unable to find the requested object or method
@@ -323,7 +321,7 @@  discard block
 block discarded – undo
323 321
             /** @var CallableObject */
324 322
             $xCallableObject = $this->getCallable($sClassName);
325 323
 
326
-            if($xCallableObject->excluded($sMethodName))
324
+            if ($xCallableObject->excluded($sMethodName))
327 325
             {
328 326
                 // Unable to find the requested class or method
329 327
                 $this->throwException('', 'errors.objects.excluded', $aErrorParams);
@@ -332,7 +330,7 @@  discard block
 block discarded – undo
332 330
             $sError = 'errors.objects.call';
333 331
             $xCallableObject->call($this->xTarget);
334 332
         }
335
-        catch(ReflectionException|SetupException $e)
333
+        catch (ReflectionException|SetupException $e)
336 334
         {
337 335
             // Unable to execute the requested class or method
338 336
             $this->throwException($e->getMessage(), $sError, $aErrorParams);
Please login to merge, or discard this patch.