@@ -26,7 +26,7 @@ |
||
26 | 26 | public function onChange(Config $xConfig, string $sName) |
27 | 27 | { |
28 | 28 | // Set the library language any time the config is changed. |
29 | - if($sName === '' || $sName === 'core.language') |
|
29 | + if ($sName === '' || $sName === 'core.language') |
|
30 | 30 | { |
31 | 31 | $this->setLocale($xConfig->getOption('core.language')); |
32 | 32 | } |
@@ -133,15 +133,15 @@ discard block |
||
133 | 133 | */ |
134 | 134 | public function checkOptions(string $sCallable, $xOptions): array |
135 | 135 | { |
136 | - if(!$this->xValidator->validateClass(trim($sCallable))) |
|
136 | + if (!$this->xValidator->validateClass(trim($sCallable))) |
|
137 | 137 | { |
138 | 138 | throw new SetupException($this->xTranslator->trans('errors.objects.invalid-declaration')); |
139 | 139 | } |
140 | - if(is_string($xOptions)) |
|
140 | + if (is_string($xOptions)) |
|
141 | 141 | { |
142 | 142 | $xOptions = ['include' => $xOptions]; |
143 | 143 | } |
144 | - elseif(!is_array($xOptions)) |
|
144 | + elseif (!is_array($xOptions)) |
|
145 | 145 | { |
146 | 146 | throw new SetupException($this->xTranslator->trans('errors.objects.invalid-declaration')); |
147 | 147 | } |
@@ -186,16 +186,16 @@ discard block |
||
186 | 186 | $sCode = ''; |
187 | 187 | $aJsClasses = []; |
188 | 188 | $aNamespaces = $this->xRepository->getNamespaces(); |
189 | - foreach($aNamespaces as $sNamespace) |
|
189 | + foreach ($aNamespaces as $sNamespace) |
|
190 | 190 | { |
191 | 191 | $offset = 0; |
192 | 192 | $sJsNamespace = str_replace('\\', '.', $sNamespace); |
193 | 193 | $sJsNamespace .= '.Null'; // This is a sentinel. The last token is not processed in the while loop. |
194 | - while(($dotPosition = strpos($sJsNamespace, '.', $offset)) !== false) |
|
194 | + while (($dotPosition = strpos($sJsNamespace, '.', $offset)) !== false) |
|
195 | 195 | { |
196 | 196 | $sJsClass = substr($sJsNamespace, 0, $dotPosition); |
197 | 197 | // Generate code for this object |
198 | - if(!isset($aJsClasses[$sJsClass])) |
|
198 | + if (!isset($aJsClasses[$sJsClass])) |
|
199 | 199 | { |
200 | 200 | $sCode .= $this->sPrefix . "$sJsClass = {};\n"; |
201 | 201 | $aJsClasses[$sJsClass] = $sJsClass; |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | */ |
217 | 217 | private function getCallableScript(string $sClassName, CallableObject $xCallableObject): string |
218 | 218 | { |
219 | - if($xCallableObject->excluded()) |
|
219 | + if ($xCallableObject->excluded()) |
|
220 | 220 | { |
221 | 221 | return ''; |
222 | 222 | } |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | }); |
245 | 245 | |
246 | 246 | $sCode = $this->getNamespacesScript(); |
247 | - foreach($aCallableObjects as $sClassName => $xCallableObject) |
|
247 | + foreach ($aCallableObjects as $sClassName => $xCallableObject) |
|
248 | 248 | { |
249 | 249 | $sCode .= $this->getCallableScript($sClassName, $xCallableObject); |
250 | 250 | } |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | public static function canProcessRequest(ServerRequestInterface $xRequest): bool |
258 | 258 | { |
259 | 259 | $aBody = $xRequest->getParsedBody(); |
260 | - if(is_array($aBody)) |
|
260 | + if (is_array($aBody)) |
|
261 | 261 | { |
262 | 262 | return isset($aBody['jxncls']) && isset($aBody['jxnmthd']); |
263 | 263 | } |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | public function setTarget(ServerRequestInterface $xRequest) |
272 | 272 | { |
273 | 273 | $aBody = $xRequest->getParsedBody(); |
274 | - if(is_array($aBody)) |
|
274 | + if (is_array($aBody)) |
|
275 | 275 | { |
276 | 276 | $this->xTarget = Target::makeClass(trim($aBody['jxncls']), trim($aBody['jxnmthd'])); |
277 | 277 | return; |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | $sMethodName = $this->xTarget->getMethodName(); |
291 | 291 | $this->xTarget->setMethodArgs($this->xParameterReader->args()); |
292 | 292 | |
293 | - if(!$this->xValidator->validateClass($sClassName) || !$this->xValidator->validateMethod($sMethodName)) |
|
293 | + if (!$this->xValidator->validateClass($sClassName) || !$this->xValidator->validateMethod($sMethodName)) |
|
294 | 294 | { |
295 | 295 | // Unable to find the requested object or method |
296 | 296 | throw new RequestException($this->xTranslator->trans('errors.objects.invalid', |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | $xCallableObject = $this->xRegistry->getCallableObject($sClassName); |
304 | 304 | return $xCallableObject->call($this->xTarget); |
305 | 305 | } |
306 | - catch(ReflectionException|SetupException $e) |
|
306 | + catch (ReflectionException | SetupException $e) |
|
307 | 307 | { |
308 | 308 | // Unable to find the requested class or method |
309 | 309 | $this->di->getLogger()->error($e->getMessage()); |
@@ -140,8 +140,7 @@ discard block |
||
140 | 140 | if(is_string($xOptions)) |
141 | 141 | { |
142 | 142 | $xOptions = ['include' => $xOptions]; |
143 | - } |
|
144 | - elseif(!is_array($xOptions)) |
|
143 | + } elseif(!is_array($xOptions)) |
|
145 | 144 | { |
146 | 145 | throw new SetupException($this->xTranslator->trans('errors.objects.invalid-declaration')); |
147 | 146 | } |
@@ -302,8 +301,7 @@ discard block |
||
302 | 301 | { |
303 | 302 | $xCallableObject = $this->xRegistry->getCallableObject($sClassName); |
304 | 303 | return $xCallableObject->call($this->xTarget); |
305 | - } |
|
306 | - catch(ReflectionException|SetupException $e) |
|
304 | + } catch(ReflectionException|SetupException $e) |
|
307 | 305 | { |
308 | 306 | // Unable to find the requested class or method |
309 | 307 | $this->di->getLogger()->error($e->getMessage()); |