@@ -1,3 +1,3 @@ |
||
| 1 | -<?php foreach($this->aUrls as $sUrl): |
|
| 1 | +<?php foreach ($this->aUrls as $sUrl): |
|
| 2 | 2 | $this->include('jaxon::plugins/include.js', ['sUrl' => $sUrl, 'sJsOptions' => $this->sJsOptions]); |
| 3 | 3 | endforeach; |
@@ -37,7 +37,6 @@ |
||
| 37 | 37 | public function getMetadataReader(string $sReaderId): MetadataReaderInterface |
| 38 | 38 | { |
| 39 | 39 | return $this->h("metadata_reader_$sReaderId") ? |
| 40 | - $this->g("metadata_reader_$sReaderId") : |
|
| 41 | - $this->g('metadata_reader_null'); |
|
| 40 | + $this->g("metadata_reader_$sReaderId") : $this->g('metadata_reader_null'); |
|
| 42 | 41 | } |
| 43 | 42 | } |
@@ -42,13 +42,13 @@ |
||
| 42 | 42 | */ |
| 43 | 43 | public function make(string|ReflectionClass $xClass): mixed |
| 44 | 44 | { |
| 45 | - if(is_string($xClass)) |
|
| 45 | + if (is_string($xClass)) |
|
| 46 | 46 | { |
| 47 | 47 | // Create the reflection class instance |
| 48 | 48 | $xClass = new ReflectionClass($xClass); |
| 49 | 49 | } |
| 50 | 50 | // Use the Reflection class to get the parameters of the constructor |
| 51 | - if(($constructor = $xClass->getConstructor()) === null) |
|
| 51 | + if (($constructor = $xClass->getConstructor()) === null) |
|
| 52 | 52 | { |
| 53 | 53 | return $xClass->newInstance(); |
| 54 | 54 | } |
@@ -58,8 +58,7 @@ |
||
| 58 | 58 | $xParameterReader = $di->g(ParameterReader::class); |
| 59 | 59 | $xRequest = $di->g(ServerRequestInterface::class); |
| 60 | 60 | $aRequestParameter = $xParameterReader->getRequestParameter($xRequest); |
| 61 | - return !is_array($aRequestParameter) ? $xRequest : |
|
| 62 | - $xRequest->withAttribute('jxncall', $aRequestParameter); |
|
| 61 | + return !is_array($aRequestParameter) ? $xRequest : $xRequest->withAttribute('jxncall', $aRequestParameter); |
|
| 63 | 62 | }); |
| 64 | 63 | // PSR factory |
| 65 | 64 | $this->set(PsrFactory::class, function($di) { |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | public function registerPackage(string $sClassName, array $aUserOptions): void |
| 194 | 194 | { |
| 195 | 195 | // Register the user class, but only if the user didn't already. |
| 196 | - if(!$this->h($sClassName)) |
|
| 196 | + if (!$this->h($sClassName)) |
|
| 197 | 197 | { |
| 198 | 198 | $this->set($sClassName, fn() => $this->make($sClassName)); |
| 199 | 199 | } |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | $this->set($sConfigKey, function($di) use($aUserOptions) { |
| 204 | 204 | $xOptionsProvider = $aUserOptions['provider'] ?? null; |
| 205 | 205 | // The user can provide a callable that returns the package options. |
| 206 | - if(is_callable($xOptionsProvider)) |
|
| 206 | + if (is_callable($xOptionsProvider)) |
|
| 207 | 207 | { |
| 208 | 208 | $aUserOptions = $xOptionsProvider($aUserOptions); |
| 209 | 209 | } |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | */ |
| 187 | 187 | private function getCommandArgs(array|JsonSerializable $aArgs, bool $bRemoveEmpty = false): array |
| 188 | 188 | { |
| 189 | - if(!$bRemoveEmpty) |
|
| 189 | + if (!$bRemoveEmpty) |
|
| 190 | 190 | { |
| 191 | 191 | return $aArgs; |
| 192 | 192 | } |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | 'name' => $this->str($sName), |
| 212 | 212 | 'args' => $this->getCommandArgs($aArgs, $bRemoveEmpty), |
| 213 | 213 | ]); |
| 214 | - if($this->bOnConfirm) |
|
| 214 | + if ($this->bOnConfirm) |
|
| 215 | 215 | { |
| 216 | 216 | $this->aConfirmCommands[] = $xCommand; |
| 217 | 217 | } |
@@ -240,14 +240,14 @@ discard block |
||
| 240 | 240 | public function addConfirmCommand(string $sName, Closure $fConfirm, |
| 241 | 241 | string $sQuestion, array $aArgs = []): self |
| 242 | 242 | { |
| 243 | - if($this->bOnConfirm) |
|
| 243 | + if ($this->bOnConfirm) |
|
| 244 | 244 | { |
| 245 | 245 | throw new AppException($this->xTranslator->trans('errors.app.confirm.nested')); |
| 246 | 246 | } |
| 247 | 247 | $this->bOnConfirm = true; |
| 248 | 248 | $fConfirm(); |
| 249 | 249 | $this->bOnConfirm = false; |
| 250 | - if(($nCommandCount = count($this->aConfirmCommands)) > 0) |
|
| 250 | + if (($nCommandCount = count($this->aConfirmCommands)) > 0) |
|
| 251 | 251 | { |
| 252 | 252 | $aCommand = $this->di->getDialogCommand()->confirm($this->str($sQuestion), $aArgs); |
| 253 | 253 | $aCommand['count'] = $nCommandCount; |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | */ |
| 355 | 355 | public function printDebug() |
| 356 | 356 | { |
| 357 | - foreach($this->aDebugMessages as $sMessage) |
|
| 357 | + foreach ($this->aDebugMessages as $sMessage) |
|
| 358 | 358 | { |
| 359 | 359 | $this->addCommand('script.debug', ['message' => $this->str($sMessage)]); |
| 360 | 360 | } |
@@ -368,8 +368,7 @@ discard block |
||
| 368 | 368 | */ |
| 369 | 369 | public function getContentType(): string |
| 370 | 370 | { |
| 371 | - return empty($this->sCharacterEncoding) ? $this->getResponse()->getContentType() : |
|
| 372 | - $this->getResponse()->getContentType() . '; charset="' . $this->sCharacterEncoding . '"'; |
|
| 371 | + return empty($this->sCharacterEncoding) ? $this->getResponse()->getContentType() : $this->getResponse()->getContentType() . '; charset="' . $this->sCharacterEncoding . '"'; |
|
| 373 | 372 | } |
| 374 | 373 | |
| 375 | 374 | /** |
@@ -66,7 +66,7 @@ |
||
| 66 | 66 | */ |
| 67 | 67 | public function setOption(string $sName, string|array|JsonSerializable $xValue): Command |
| 68 | 68 | { |
| 69 | - if(isset($this->aCommand['options'])) |
|
| 69 | + if (isset($this->aCommand['options'])) |
|
| 70 | 70 | { |
| 71 | 71 | $this->aCommand['options'][$this->str($sName)] = $xValue; |
| 72 | 72 | return $this; |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | private function _registerPlugin(string $sClassName, string $sPluginName, array $aInterfaces): int |
| 101 | 101 | { |
| 102 | 102 | // Any plugin must implement the PluginInterface interface. |
| 103 | - if(!in_array(PluginInterface::class, $aInterfaces)) |
|
| 103 | + if (!in_array(PluginInterface::class, $aInterfaces)) |
|
| 104 | 104 | { |
| 105 | 105 | $sMessage = $this->xTranslator->trans('errors.register.invalid', [ |
| 106 | 106 | 'name' => $sClassName, |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | // Response plugin. |
| 112 | - if(in_array(ResponsePluginInterface::class, $aInterfaces)) |
|
| 112 | + if (in_array(ResponsePluginInterface::class, $aInterfaces)) |
|
| 113 | 113 | { |
| 114 | 114 | $this->aResponsePlugins[$sPluginName] = $sClassName; |
| 115 | 115 | return 1; |
@@ -117,12 +117,12 @@ discard block |
||
| 117 | 117 | |
| 118 | 118 | // Request plugin. |
| 119 | 119 | $nCount = 0; |
| 120 | - if(in_array(CallableRegistryInterface::class, $aInterfaces)) |
|
| 120 | + if (in_array(CallableRegistryInterface::class, $aInterfaces)) |
|
| 121 | 121 | { |
| 122 | 122 | $this->aRegistryPlugins[$sPluginName] = $sClassName; |
| 123 | 123 | $nCount++; |
| 124 | 124 | } |
| 125 | - if(in_array(RequestHandlerInterface::class, $aInterfaces)) |
|
| 125 | + if (in_array(RequestHandlerInterface::class, $aInterfaces)) |
|
| 126 | 126 | { |
| 127 | 127 | $this->aRequestHandlers[$sPluginName] = $sClassName; |
| 128 | 128 | $nCount++; |
@@ -151,13 +151,13 @@ discard block |
||
| 151 | 151 | $nCount = $this->_registerPlugin($sClassName, $sPluginName, $aInterfaces); |
| 152 | 152 | |
| 153 | 153 | // Any plugin can implement the CodeGeneratorInterface interface. |
| 154 | - if(in_array(CodeGeneratorInterface::class, $aInterfaces)) |
|
| 154 | + if (in_array(CodeGeneratorInterface::class, $aInterfaces)) |
|
| 155 | 155 | { |
| 156 | 156 | $this->xCodeGenerator->addCodeGenerator($sClassName, $nPriority); |
| 157 | 157 | $nCount++; |
| 158 | 158 | } |
| 159 | 159 | // The class is not a valid plugin. |
| 160 | - if($nCount === 0) |
|
| 160 | + if ($nCount === 0) |
|
| 161 | 161 | { |
| 162 | 162 | $sMessage = $this->xTranslator->trans('errors.register.invalid', [ |
| 163 | 163 | 'name' => $sClassName, |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | // Register the plugin in the DI container, if necessary |
| 169 | - if(!$this->di->has($sClassName)) |
|
| 169 | + if (!$this->di->has($sClassName)) |
|
| 170 | 170 | { |
| 171 | 171 | $this->di->auto($sClassName); |
| 172 | 172 | } |
@@ -182,8 +182,7 @@ discard block |
||
| 182 | 182 | */ |
| 183 | 183 | public function getResponsePlugin(string $sName): ?ResponsePluginInterface |
| 184 | 184 | { |
| 185 | - return $this->di->h($sName) ? $this->di->g($sName) : |
|
| 186 | - (!isset($this->aResponsePlugins[$sName]) ? null : |
|
| 185 | + return $this->di->h($sName) ? $this->di->g($sName) : (!isset($this->aResponsePlugins[$sName]) ? null : |
|
| 187 | 186 | $this->di->g($this->aResponsePlugins[$sName])); |
| 188 | 187 | } |
| 189 | 188 | |
@@ -201,7 +200,7 @@ discard block |
||
| 201 | 200 | */ |
| 202 | 201 | public function registerCallable(string $sType, string $sCallable, $xOptions = []): void |
| 203 | 202 | { |
| 204 | - if(isset($this->aRegistryPlugins[$sType]) && |
|
| 203 | + if (isset($this->aRegistryPlugins[$sType]) && |
|
| 205 | 204 | ($xPlugin = $this->di->g($this->aRegistryPlugins[$sType]))) |
| 206 | 205 | { |
| 207 | 206 | $xPlugin->register($sType, $sCallable, $xPlugin->checkOptions($sCallable, $xOptions)); |
@@ -63,7 +63,7 @@ |
||
| 63 | 63 | public function ajaxResponse(): ResponseInterface |
| 64 | 64 | { |
| 65 | 65 | $xPsrResponse = $this->xPsr17Factory->createResponse(200); |
| 66 | - if($this->xRequest->getMethod() === 'GET') |
|
| 66 | + if ($this->xRequest->getMethod() === 'GET') |
|
| 67 | 67 | { |
| 68 | 68 | $xPsrResponse = $xPsrResponse |
| 69 | 69 | ->withHeader('Expires', 'Mon, 26 Jul 1997 05:00:00 GMT') |