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 2 patches
Switch Indentation   +210 added lines, -210 removed lines patch added patch discarded remove patch
@@ -46,17 +46,17 @@  discard block
 block discarded – undo
46 46
 
47 47
 class CallableClassPlugin extends AbstractRequestPlugin
48 48
 {
49
-    /**
49
+/**
50 50
      * @var array<CallableObject>
51 51
      */
52
-    private array $aCallableObjects = [];
52
+private array $aCallableObjects = [];
53 53
 
54
-    /**
54
+/**
55 55
      * @var array<string>
56 56
      */
57
-    private array $aCallableNames = [];
57
+private array $aCallableNames = [];
58 58
 
59
-    /**
59
+/**
60 60
      * The class constructor
61 61
      *
62 62
      * @param string $sPrefix
@@ -67,150 +67,150 @@  discard block
 block discarded – undo
67 67
      * @param TemplateEngine $xTemplateEngine
68 68
      * @param Validator $xValidator
69 69
      */
70
-    public function __construct(private string $sPrefix,
71
-        private LoggerInterface $xLogger, private ComponentContainer $cdi,
72
-        private ComponentRegistry $xRegistry, private Translator $xTranslator,
73
-        private TemplateEngine $xTemplateEngine, private Validator $xValidator)
74
-    {}
70
+public function __construct(private string $sPrefix,
71
+private LoggerInterface $xLogger, private ComponentContainer $cdi,
72
+private ComponentRegistry $xRegistry, private Translator $xTranslator,
73
+private TemplateEngine $xTemplateEngine, private Validator $xValidator)
74
+{}
75 75
 
76
-    /**
76
+/**
77 77
      * @inheritDoc
78 78
      */
79
-    public function getName(): string
80
-    {
81
-        return Jaxon::CALLABLE_CLASS;
82
-    }
79
+public function getName(): string
80
+{
81
+return Jaxon::CALLABLE_CLASS;
82
+}
83 83
 
84
-    /**
84
+/**
85 85
      * @inheritDoc
86 86
      * @throws SetupException
87 87
      */
88
-    public function checkOptions(string $sCallable, $xOptions): array
89
-    {
90
-        if(!$this->xValidator->validateClass(trim($sCallable)))
91
-        {
92
-            throw new SetupException($this->xTranslator->trans('errors.objects.invalid-declaration'));
93
-        }
94
-        if(is_string($xOptions))
95
-        {
96
-            $xOptions = ['include' => $xOptions];
97
-        }
98
-        elseif(!is_array($xOptions))
99
-        {
100
-            throw new SetupException($this->xTranslator->trans('errors.objects.invalid-declaration'));
101
-        }
102
-        return $xOptions;
103
-    }
104
-
105
-    /**
88
+public function checkOptions(string $sCallable, $xOptions): array
89
+{
90
+if(!$this->xValidator->validateClass(trim($sCallable)))
91
+{
92
+throw new SetupException($this->xTranslator->trans('errors.objects.invalid-declaration'));
93
+}
94
+if(is_string($xOptions))
95
+{
96
+$xOptions = ['include' => $xOptions];
97
+}
98
+elseif(!is_array($xOptions))
99
+{
100
+throw new SetupException($this->xTranslator->trans('errors.objects.invalid-declaration'));
101
+}
102
+return $xOptions;
103
+}
104
+
105
+/**
106 106
      * @inheritDoc
107 107
      */
108
-    public function register(string $sType, string $sCallable, array $aOptions): bool
109
-    {
110
-        $sClassName = trim($sCallable);
111
-        $this->xRegistry->registerComponent($sClassName, $aOptions);
112
-        return true;
113
-    }
114
-
115
-    /**
108
+public function register(string $sType, string $sCallable, array $aOptions): bool
109
+{
110
+$sClassName = trim($sCallable);
111
+$this->xRegistry->registerComponent($sClassName, $aOptions);
112
+return true;
113
+}
114
+
115
+/**
116 116
      * @inheritDoc
117 117
      * @throws SetupException
118 118
      */
119
-    public function getCallable(string $sCallable): CallableObject|null
120
-    {
121
-        return $this->cdi->makeCallableObject($sCallable);
122
-    }
119
+public function getCallable(string $sCallable): CallableObject|null
120
+{
121
+return $this->cdi->makeCallableObject($sCallable);
122
+}
123 123
 
124
-    /**
124
+/**
125 125
      * @inheritDoc
126 126
      */
127
-    public function getHash(): string
128
-    {
129
-        $this->xRegistry->registerAllComponents();
130
-        return md5($this->xRegistry->getHash());
131
-    }
127
+public function getHash(): string
128
+{
129
+$this->xRegistry->registerAllComponents();
130
+return md5($this->xRegistry->getHash());
131
+}
132 132
 
133
-    /**
133
+/**
134 134
      * Add a callable object to the script generator
135 135
      *
136 136
      * @param CallableObject $xCallableObject
137 137
      *
138 138
      * @return void
139 139
      */
140
-    private function addCallable(CallableObject $xCallableObject): void
141
-    {
142
-        $aCallableMethods = $xCallableObject->getCallableMethods();
143
-        if($xCallableObject->excluded() || count($aCallableMethods) === 0)
144
-        {
145
-            return;
146
-        }
147
-
148
-        $aCallableObject = &$this->aCallableObjects;
149
-        $sJsName = $xCallableObject->getJsName();
150
-        foreach(explode('.', $sJsName) as $sName)
151
-        {
152
-            if(!isset($aCallableObject['children'][$sName]))
153
-            {
154
-                $aCallableObject['children'][$sName] = [];
155
-            }
156
-            $aCallableObject = &$aCallableObject['children'][$sName];
157
-        }
158
-
159
-        $aCallableObject['methods'] = $aCallableMethods;
160
-        $aCallableObject['index'] = count($this->aCallableNames);
161
-        $this->aCallableNames[] = $sJsName;
162
-    }
163
-
164
-    /**
140
+private function addCallable(CallableObject $xCallableObject): void
141
+{
142
+$aCallableMethods = $xCallableObject->getCallableMethods();
143
+if($xCallableObject->excluded() || count($aCallableMethods) === 0)
144
+{
145
+return;
146
+}
147
+
148
+$aCallableObject = &$this->aCallableObjects;
149
+$sJsName = $xCallableObject->getJsName();
150
+foreach(explode('.', $sJsName) as $sName)
151
+{
152
+if(!isset($aCallableObject['children'][$sName]))
153
+{
154
+    $aCallableObject['children'][$sName] = [];
155
+}
156
+$aCallableObject = &$aCallableObject['children'][$sName];
157
+}
158
+
159
+$aCallableObject['methods'] = $aCallableMethods;
160
+$aCallableObject['index'] = count($this->aCallableNames);
161
+$this->aCallableNames[] = $sJsName;
162
+}
163
+
164
+/**
165 165
      * @param string $sIndent
166 166
      * @param array $aTemplateVars
167 167
      *
168 168
      * @return string
169 169
      */
170
-    private function renderMethod(string $sIndent, array $aTemplateVars): string
171
-    {
172
-        $aOptions = [];
173
-        foreach($aTemplateVars['aMethod']['options'] as $sKey => $sValue)
174
-        {
175
-            $aOptions[] = "$sKey: $sValue";
176
-        }
177
-        $aTemplateVars['sArguments'] = count($aOptions) === 0 ? 'args' :
178
-            'args, { ' . implode(', ', $aOptions) . ' }';
179
-
180
-        return $sIndent . trim($this->xTemplateEngine
181
-            ->render('jaxon::callables/method.js', $aTemplateVars));
182
-    }
183
-
184
-    /**
170
+private function renderMethod(string $sIndent, array $aTemplateVars): string
171
+{
172
+$aOptions = [];
173
+foreach($aTemplateVars['aMethod']['options'] as $sKey => $sValue)
174
+{
175
+$aOptions[] = "$sKey: $sValue";
176
+}
177
+$aTemplateVars['sArguments'] = count($aOptions) === 0 ? 'args' :
178
+'args, { ' . implode(', ', $aOptions) . ' }';
179
+
180
+return $sIndent . trim($this->xTemplateEngine
181
+->render('jaxon::callables/method.js', $aTemplateVars));
182
+}
183
+
184
+/**
185 185
      * @param string $sJsClass
186 186
      * @param array $aCallable
187 187
      * @param int $nIndent
188 188
      *
189 189
      * @return string
190 190
      */
191
-    private function renderCallable(string $sJsClass, array $aCallable, int $nIndent): string
192
-    {
193
-        $nIndent += 2; // Indentation.
194
-        $sIndent = str_repeat(' ', $nIndent);
195
-
196
-        $fMethodCallback = fn($aMethod) => $this->renderMethod($sIndent, [
197
-            'aMethod' => $aMethod,
198
-            'nIndex' => $aCallable['index'] ?? 0,
199
-        ]);
200
-        $aMethods = !isset($aCallable['methods']) ? [] :
201
-            array_map($fMethodCallback, $aCallable['methods']);
202
-
203
-        $aChildren = [];
204
-        foreach($aCallable['children'] ?? [] as $sName => $aChild)
205
-        {
206
-            $aChildren[] = $this->renderChild("$sName:", "$sJsClass.$sName",
207
-                $aChild, $nIndent) . ',';
208
-        }
209
-
210
-        return implode("\n", array_merge($aMethods, $aChildren));
211
-    }
212
-
213
-    /**
191
+private function renderCallable(string $sJsClass, array $aCallable, int $nIndent): string
192
+{
193
+$nIndent += 2; // Indentation.
194
+$sIndent = str_repeat(' ', $nIndent);
195
+
196
+$fMethodCallback = fn($aMethod) => $this->renderMethod($sIndent, [
197
+'aMethod' => $aMethod,
198
+'nIndex' => $aCallable['index'] ?? 0,
199
+]);
200
+$aMethods = !isset($aCallable['methods']) ? [] :
201
+array_map($fMethodCallback, $aCallable['methods']);
202
+
203
+$aChildren = [];
204
+foreach($aCallable['children'] ?? [] as $sName => $aChild)
205
+{
206
+$aChildren[] = $this->renderChild("$sName:", "$sJsClass.$sName",
207
+    $aChild, $nIndent) . ',';
208
+}
209
+
210
+return implode("\n", array_merge($aMethods, $aChildren));
211
+}
212
+
213
+/**
214 214
      * @param string $sJsVar
215 215
      * @param string $sJsClass
216 216
      * @param array $aCallable
@@ -218,70 +218,70 @@  discard block
 block discarded – undo
218 218
      *
219 219
      * @return string
220 220
      */
221
-    private function renderChild(string $sJsVar, string $sJsClass,
222
-        array $aCallable, int $nIndent = 0): string
223
-    {
224
-        $sIndent = str_repeat(' ', $nIndent);
225
-        $sScript = $this->renderCallable($sJsClass, $aCallable, $nIndent);
221
+private function renderChild(string $sJsVar, string $sJsClass,
222
+array $aCallable, int $nIndent = 0): string
223
+{
224
+$sIndent = str_repeat(' ', $nIndent);
225
+$sScript = $this->renderCallable($sJsClass, $aCallable, $nIndent);
226 226
 
227
-        return <<<CODE
227
+return <<<CODE
228 228
 $sIndent$sJsVar {
229 229
 $sScript
230 230
 $sIndent}
231 231
 CODE;
232
-    }
232
+}
233 233
 
234
-    /**
234
+/**
235 235
      * Generate client side javascript code for the registered callable objects
236 236
      *
237 237
      * @return string
238 238
      * @throws SetupException
239 239
      */
240
-    public function getScript(): string
241
-    {
242
-        $this->xRegistry->registerAllComponents();
243
-
244
-        $this->aCallableNames = [];
245
-        $this->aCallableObjects = ['children' => []];
246
-        foreach($this->cdi->getCallableObjects() as $xCallableObject)
247
-        {
248
-            $this->addCallable($xCallableObject);
249
-        }
250
-
251
-        $aScripts = [
252
-            $this->xTemplateEngine ->render('jaxon::callables/objects.js', [
253
-                'aCallableNames' => $this->aCallableNames,
254
-            ])
255
-        ];
256
-        foreach($this->aCallableObjects['children'] as $sJsClass => $aCallable)
257
-        {
258
-            $aScripts[] = $this->renderChild("{$this->sPrefix}$sJsClass =",
259
-                $sJsClass, $aCallable) . ';';
260
-        }
261
-        return implode("\n", $aScripts) . "\n";
262
-    }
263
-
264
-    /**
240
+public function getScript(): string
241
+{
242
+$this->xRegistry->registerAllComponents();
243
+
244
+$this->aCallableNames = [];
245
+$this->aCallableObjects = ['children' => []];
246
+foreach($this->cdi->getCallableObjects() as $xCallableObject)
247
+{
248
+$this->addCallable($xCallableObject);
249
+}
250
+
251
+$aScripts = [
252
+$this->xTemplateEngine ->render('jaxon::callables/objects.js', [
253
+    'aCallableNames' => $this->aCallableNames,
254
+])
255
+];
256
+foreach($this->aCallableObjects['children'] as $sJsClass => $aCallable)
257
+{
258
+$aScripts[] = $this->renderChild("{$this->sPrefix}$sJsClass =",
259
+    $sJsClass, $aCallable) . ';';
260
+}
261
+return implode("\n", $aScripts) . "\n";
262
+}
263
+
264
+/**
265 265
      * @inheritDoc
266 266
      */
267
-    public static function canProcessRequest(ServerRequestInterface $xRequest): bool
268
-    {
269
-        $aCall = $xRequest->getAttribute('jxncall');
270
-        return $aCall !== null && ($aCall['type'] ?? '') === 'class' &&
271
-            isset($aCall['name']) && isset($aCall['method']) &&
272
-            is_string($aCall['name']) && is_string($aCall['method']);
273
-    }
274
-
275
-    /**
267
+public static function canProcessRequest(ServerRequestInterface $xRequest): bool
268
+{
269
+$aCall = $xRequest->getAttribute('jxncall');
270
+return $aCall !== null && ($aCall['type'] ?? '') === 'class' &&
271
+isset($aCall['name']) && isset($aCall['method']) &&
272
+is_string($aCall['name']) && is_string($aCall['method']);
273
+}
274
+
275
+/**
276 276
      * @inheritDoc
277 277
      */
278
-    public function setTarget(ServerRequestInterface $xRequest): Target
279
-    {
280
-        $this->xTarget = Target::makeClass($xRequest->getAttribute('jxncall'));
281
-        return $this->xTarget;
282
-    }
278
+public function setTarget(ServerRequestInterface $xRequest): Target
279
+{
280
+$this->xTarget = Target::makeClass($xRequest->getAttribute('jxncall'));
281
+return $this->xTarget;
282
+}
283 283
 
284
-    /**
284
+/**
285 285
      * @param string $sExceptionMessage
286 286
      * @param string $sErrorCode
287 287
      * @param array $aErrorParams
@@ -289,53 +289,53 @@  discard block
 block discarded – undo
289 289
      * @throws RequestException
290 290
      * @return void
291 291
      */
292
-    private function throwException(string $sExceptionMessage,
293
-        string $sErrorCode, array $aErrorParams = []): void
294
-    {
295
-        $sMessage = $this->xTranslator->trans($sErrorCode, $aErrorParams) .
296
-            (!$sExceptionMessage ? '' : "\n$sExceptionMessage");
297
-        $this->xLogger->error($sMessage);
298
-        throw new RequestException($sMessage);
299
-    }
300
-
301
-    /**
292
+private function throwException(string $sExceptionMessage,
293
+string $sErrorCode, array $aErrorParams = []): void
294
+{
295
+$sMessage = $this->xTranslator->trans($sErrorCode, $aErrorParams) .
296
+(!$sExceptionMessage ? '' : "\n$sExceptionMessage");
297
+$this->xLogger->error($sMessage);
298
+throw new RequestException($sMessage);
299
+}
300
+
301
+/**
302 302
      * @inheritDoc
303 303
      * @throws RequestException
304 304
      */
305
-    public function processRequest(): void
306
-    {
307
-        $sClassName = $this->xTarget->getClassName();
308
-        $sMethodName = $this->xTarget->getMethodName();
309
-        // Will be used to print a translated error message.
310
-        $aErrorParams = ['class' => $sClassName, 'method' => $sMethodName];
311
-
312
-        if(!$this->xValidator->validateJsObject($sClassName) ||
313
-            !$this->xValidator->validateMethod($sMethodName))
314
-        {
315
-            // Unable to find the requested object or method
316
-            $this->throwException('', 'errors.objects.invalid', $aErrorParams);
317
-        }
318
-
319
-        // Call the requested method
320
-        try
321
-        {
322
-            $sError = 'errors.objects.find';
323
-            /** @var CallableObject */
324
-            $xCallableObject = $this->getCallable($sClassName);
325
-
326
-            if($xCallableObject->excluded($sMethodName))
327
-            {
328
-                // Unable to find the requested class or method
329
-                $this->throwException('', 'errors.objects.excluded', $aErrorParams);
330
-            }
331
-
332
-            $sError = 'errors.objects.call';
333
-            $xCallableObject->call($this->xTarget);
334
-        }
335
-        catch(ReflectionException|SetupException $e)
336
-        {
337
-            // Unable to execute the requested class or method
338
-            $this->throwException($e->getMessage(), $sError, $aErrorParams);
339
-        }
340
-    }
305
+public function processRequest(): void
306
+{
307
+$sClassName = $this->xTarget->getClassName();
308
+$sMethodName = $this->xTarget->getMethodName();
309
+// Will be used to print a translated error message.
310
+$aErrorParams = ['class' => $sClassName, 'method' => $sMethodName];
311
+
312
+if(!$this->xValidator->validateJsObject($sClassName) ||
313
+!$this->xValidator->validateMethod($sMethodName))
314
+{
315
+// Unable to find the requested object or method
316
+$this->throwException('', 'errors.objects.invalid', $aErrorParams);
317
+}
318
+
319
+// Call the requested method
320
+try
321
+{
322
+$sError = 'errors.objects.find';
323
+/** @var CallableObject */
324
+$xCallableObject = $this->getCallable($sClassName);
325
+
326
+if($xCallableObject->excluded($sMethodName))
327
+{
328
+    // Unable to find the requested class or method
329
+    $this->throwException('', 'errors.objects.excluded', $aErrorParams);
330
+}
331
+
332
+$sError = 'errors.objects.call';
333
+$xCallableObject->call($this->xTarget);
334
+}
335
+catch(ReflectionException|SetupException $e)
336
+{
337
+// Unable to execute the requested class or method
338
+$this->throwException($e->getMessage(), $sError, $aErrorParams);
339
+}
340
+}
341 341
 }
Please login to merge, or discard this 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.