@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | public function shallIncludeAssets(Plugin $xPlugin): bool |
| 72 | 72 | {
|
| 73 | 73 | $sPluginOptionName = 'assets.include.' . $xPlugin->getName(); |
| 74 | - if($this->xConfigManager->hasOption($sPluginOptionName)) |
|
| 74 | + if ($this->xConfigManager->hasOption($sPluginOptionName)) |
|
| 75 | 75 | {
|
| 76 | 76 | return $this->xConfigManager->getOption($sPluginOptionName); |
| 77 | 77 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | $sJsLibUri = rtrim($this->xConfigManager->getOption('js.lib.uri', self::JS_LIB_URL), '/') . '/';
|
| 91 | 91 | // Add component files to the javascript file array; |
| 92 | 92 | $aJsFiles = [$sJsLibUri . 'jaxon.core' . $sJsExtension]; |
| 93 | - if($this->xConfigManager->getOption('core.debug.on'))
|
|
| 93 | + if ($this->xConfigManager->getOption('core.debug.on'))
|
|
| 94 | 94 | {
|
| 95 | 95 | $sLanguage = $this->xConfigManager->getOption('core.language');
|
| 96 | 96 | $aJsFiles[] = $sJsLibUri . 'jaxon.debug' . $sJsExtension; |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | */ |
| 108 | 108 | public function getOptionVars(): array |
| 109 | 109 | {
|
| 110 | - if(!$this->xConfigManager->hasOption('core.request.uri'))
|
|
| 110 | + if (!$this->xConfigManager->hasOption('core.request.uri'))
|
|
| 111 | 111 | {
|
| 112 | 112 | $this->xConfigManager->setOption('core.request.uri', $this->xParameterReader->uri());
|
| 113 | 113 | } |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | // Check config options |
| 141 | 141 | // - The js.app.export option must be set to true |
| 142 | 142 | // - The js.app.uri and js.app.dir options must be set to non null values |
| 143 | - if(!$this->xConfigManager->getOption('js.app.export', false) ||
|
|
| 143 | + if (!$this->xConfigManager->getOption('js.app.export', false) ||
|
|
| 144 | 144 | !$this->xConfigManager->getOption('js.app.uri') ||
|
| 145 | 145 | !$this->xConfigManager->getOption('js.app.dir'))
|
| 146 | 146 | {
|
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | */ |
| 159 | 159 | public function createJsFiles(CodeGenerator $xCodeGenerator): string |
| 160 | 160 | {
|
| 161 | - if(!$this->shallCreateJsFiles()) |
|
| 161 | + if (!$this->shallCreateJsFiles()) |
|
| 162 | 162 | {
|
| 163 | 163 | return ''; |
| 164 | 164 | } |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | $sJsFileName = $this->xConfigManager->getOption('js.app.file') ?: $xCodeGenerator->getHash();
|
| 168 | 168 | $sJsDirectory = rtrim($this->xConfigManager->getOption('js.app.dir'), '\/') . DIRECTORY_SEPARATOR;
|
| 169 | 169 | // - The js.app.dir must be writable |
| 170 | - if(!$sJsFileName || !is_dir($sJsDirectory) || !is_writable($sJsDirectory)) |
|
| 170 | + if (!$sJsFileName || !is_dir($sJsDirectory) || !is_writable($sJsDirectory)) |
|
| 171 | 171 | {
|
| 172 | 172 | return ''; |
| 173 | 173 | } |
@@ -175,15 +175,15 @@ discard block |
||
| 175 | 175 | $sJsFilePath = $sJsDirectory . $sJsFileName . '.js'; |
| 176 | 176 | $sJsMinFilePath = $sJsDirectory . $sJsFileName . '.min.js'; |
| 177 | 177 | $sJsFileUri = rtrim($this->xConfigManager->getOption('js.app.uri'), '/') . "/$sJsFileName";
|
| 178 | - if(!is_file($sJsFilePath) && !@file_put_contents($sJsFilePath, $xCodeGenerator->getJsScript())) |
|
| 178 | + if (!is_file($sJsFilePath) && !@file_put_contents($sJsFilePath, $xCodeGenerator->getJsScript())) |
|
| 179 | 179 | {
|
| 180 | 180 | return ''; |
| 181 | 181 | } |
| 182 | - if(!$this->xConfigManager->getOption('js.app.minify', false))
|
|
| 182 | + if (!$this->xConfigManager->getOption('js.app.minify', false))
|
|
| 183 | 183 | {
|
| 184 | 184 | return $sJsFileUri . '.js'; |
| 185 | 185 | } |
| 186 | - if(!is_file($sJsMinFilePath) && !$this->xMinifier->minify($sJsFilePath, $sJsMinFilePath)) |
|
| 186 | + if (!is_file($sJsMinFilePath) && !$this->xMinifier->minify($sJsFilePath, $sJsMinFilePath)) |
|
| 187 | 187 | {
|
| 188 | 188 | // If the file cannot be minified, return the plain js file. |
| 189 | 189 | return $sJsFileUri . '.js'; |
@@ -86,12 +86,12 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | private function getPath(string $jQueryNs, string $sPath, $xContext) |
| 88 | 88 | {
|
| 89 | - if(!$sPath) |
|
| 89 | + if (!$sPath) |
|
| 90 | 90 | {
|
| 91 | 91 | // If an empty selector is given, use the event target instead |
| 92 | 92 | return "$jQueryNs(e.currentTarget)"; |
| 93 | 93 | } |
| 94 | - if(!$xContext) |
|
| 94 | + if (!$xContext) |
|
| 95 | 95 | {
|
| 96 | 96 | return "$jQueryNs('" . $sPath . "')";
|
| 97 | 97 | } |
@@ -110,12 +110,12 @@ discard block |
||
| 110 | 110 | */ |
| 111 | 111 | public function __call(string $sMethod, array $aArguments) |
| 112 | 112 | {
|
| 113 | - if(count($aArguments) === 1) |
|
| 113 | + if (count($aArguments) === 1) |
|
| 114 | 114 | {
|
| 115 | 115 | // If the only parameter is a selector, and the first call |
| 116 | 116 | // on that selector is a method, then the selector is a callback. |
| 117 | 117 | $xArgument = $aArguments[0]; |
| 118 | - if(is_a($xArgument, self::class) && $xArgument->bIsCallback === null && |
|
| 118 | + if (is_a($xArgument, self::class) && $xArgument->bIsCallback === null && |
|
| 119 | 119 | count($xArgument->aCalls) > 0 && is_a($xArgument->aCalls[0], JsCall::class)) |
| 120 | 120 | {
|
| 121 | 121 | $xArgument->bIsCallback = true; |
@@ -188,12 +188,11 @@ discard block |
||
| 188 | 188 | public function getScript(): string |
| 189 | 189 | {
|
| 190 | 190 | $sScript = $this->sPath; |
| 191 | - if(count($this->aCalls) > 0) |
|
| 191 | + if (count($this->aCalls) > 0) |
|
| 192 | 192 | {
|
| 193 | 193 | $sScript .= '.' . implode('.', $this->aCalls);
|
| 194 | 194 | } |
| 195 | - return $this->bIsCallback ? '(e) => {' . $sScript . '}' :
|
|
| 196 | - ($this->bToInt ? "parseInt($sScript)" : $sScript); |
|
| 195 | + return $this->bIsCallback ? '(e) => {' . $sScript . '}' : ($this->bToInt ? "parseInt($sScript)" : $sScript);
|
|
| 197 | 196 | } |
| 198 | 197 | |
| 199 | 198 | /** |
@@ -235,19 +235,19 @@ discard block |
||
| 235 | 235 | switch($sName) |
| 236 | 236 | {
|
| 237 | 237 | // Set the methods to call before processing the request |
| 238 | - case '__before': |
|
| 239 | - $this->setHookMethods($this->aBeforeMethods, $xValue); |
|
| 240 | - break; |
|
| 241 | - // Set the methods to call after processing the request |
|
| 242 | - case '__after': |
|
| 243 | - $this->setHookMethods($this->aAfterMethods, $xValue); |
|
| 244 | - break; |
|
| 245 | - // Set the attributes to inject in the callable object |
|
| 246 | - case '__di': |
|
| 247 | - $this->addDiOption($xValue); |
|
| 248 | - break; |
|
| 249 | - default: |
|
| 250 | - break; |
|
| 238 | + case '__before': |
|
| 239 | + $this->setHookMethods($this->aBeforeMethods, $xValue); |
|
| 240 | + break; |
|
| 241 | + // Set the methods to call after processing the request |
|
| 242 | + case '__after': |
|
| 243 | + $this->setHookMethods($this->aAfterMethods, $xValue); |
|
| 244 | + break; |
|
| 245 | + // Set the attributes to inject in the callable object |
|
| 246 | + case '__di': |
|
| 247 | + $this->addDiOption($xValue); |
|
| 248 | + break; |
|
| 249 | + default: |
|
| 250 | + break; |
|
| 251 | 251 | } |
| 252 | 252 | } |
| 253 | 253 | |
@@ -295,20 +295,20 @@ discard block |
||
| 295 | 295 | {
|
| 296 | 296 | switch($sOptionName) |
| 297 | 297 | {
|
| 298 | - case 'excluded': |
|
| 299 | - if((bool)$xOptionValue) |
|
| 300 | - {
|
|
| 301 | - $this->addProtectedMethods($sFunctionName); |
|
| 302 | - } |
|
| 303 | - break; |
|
| 304 | - // For databags, all the value are merged in a single array. |
|
| 305 | - case 'bags': |
|
| 306 | - $this->_addJsArrayOption($sFunctionName, $sOptionName, $xOptionValue); |
|
| 307 | - return; |
|
| 308 | - // For all the other options, including callback, only the last value is kept. |
|
| 309 | - case 'callback': |
|
| 310 | - default: |
|
| 311 | - $this->_setJsOption($sFunctionName, $sOptionName, $xOptionValue); |
|
| 298 | + case 'excluded': |
|
| 299 | + if((bool)$xOptionValue) |
|
| 300 | + {
|
|
| 301 | + $this->addProtectedMethods($sFunctionName); |
|
| 302 | + } |
|
| 303 | + break; |
|
| 304 | + // For databags, all the value are merged in a single array. |
|
| 305 | + case 'bags': |
|
| 306 | + $this->_addJsArrayOption($sFunctionName, $sOptionName, $xOptionValue); |
|
| 307 | + return; |
|
| 308 | + // For all the other options, including callback, only the last value is kept. |
|
| 309 | + case 'callback': |
|
| 310 | + default: |
|
| 311 | + $this->_setJsOption($sFunctionName, $sOptionName, $xOptionValue); |
|
| 312 | 312 | } |
| 313 | 313 | } |
| 314 | 314 | |
@@ -81,29 +81,29 @@ discard block |
||
| 81 | 81 | public function __construct(array $aOptions, array $aAnnotations) |
| 82 | 82 | {
|
| 83 | 83 | [$bExcluded, $aAnnotationOptions, $aAnnotationProtected] = $aAnnotations; |
| 84 | - $this->bExcluded = $bExcluded || (bool)($aOptions['excluded'] ?? false); |
|
| 85 | - if($this->bExcluded) |
|
| 84 | + $this->bExcluded = $bExcluded || (bool) ($aOptions['excluded'] ?? false); |
|
| 85 | + if ($this->bExcluded) |
|
| 86 | 86 | {
|
| 87 | 87 | return; |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | $sSeparator = $aOptions['separator']; |
| 91 | - if($sSeparator === '_' || $sSeparator === '.') |
|
| 91 | + if ($sSeparator === '_' || $sSeparator === '.') |
|
| 92 | 92 | {
|
| 93 | 93 | $this->sSeparator = $sSeparator; |
| 94 | 94 | } |
| 95 | 95 | $this->addProtectedMethods($aOptions['protected']); |
| 96 | 96 | $this->addProtectedMethods($aAnnotationProtected); |
| 97 | 97 | |
| 98 | - foreach($aOptions['functions'] as $sNames => $aFunctionOptions) |
|
| 98 | + foreach ($aOptions['functions'] as $sNames => $aFunctionOptions) |
|
| 99 | 99 | {
|
| 100 | 100 | $aFunctionNames = explode(',', $sNames); // Names are in comma-separated list.
|
| 101 | - foreach($aFunctionNames as $sFunctionName) |
|
| 101 | + foreach ($aFunctionNames as $sFunctionName) |
|
| 102 | 102 | {
|
| 103 | 103 | $this->addFunctionOptions($sFunctionName, $aFunctionOptions); |
| 104 | 104 | } |
| 105 | 105 | } |
| 106 | - foreach($aAnnotationOptions as $sFunctionName => $aFunctionOptions) |
|
| 106 | + foreach ($aAnnotationOptions as $sFunctionName => $aFunctionOptions) |
|
| 107 | 107 | {
|
| 108 | 108 | $this->addFunctionOptions($sFunctionName, $aFunctionOptions); |
| 109 | 109 | } |
@@ -116,14 +116,14 @@ discard block |
||
| 116 | 116 | */ |
| 117 | 117 | private function addProtectedMethods($xMethods) |
| 118 | 118 | {
|
| 119 | - if(!is_array($xMethods)) |
|
| 119 | + if (!is_array($xMethods)) |
|
| 120 | 120 | {
|
| 121 | - $this->aProtectedMethods[trim((string)$xMethods)] = true; |
|
| 121 | + $this->aProtectedMethods[trim((string) $xMethods)] = true; |
|
| 122 | 122 | return; |
| 123 | 123 | } |
| 124 | - foreach($xMethods as $sMethod) |
|
| 124 | + foreach ($xMethods as $sMethod) |
|
| 125 | 125 | {
|
| 126 | - $this->aProtectedMethods[trim((string)$sMethod)] = true; |
|
| 126 | + $this->aProtectedMethods[trim((string) $sMethod)] = true; |
|
| 127 | 127 | } |
| 128 | 128 | } |
| 129 | 129 | |
@@ -197,17 +197,17 @@ discard block |
||
| 197 | 197 | */ |
| 198 | 198 | private function setHookMethods(array &$aHookMethods, $xValue) |
| 199 | 199 | {
|
| 200 | - foreach($xValue as $sCalledMethod => $xMethodToCall) |
|
| 200 | + foreach ($xValue as $sCalledMethod => $xMethodToCall) |
|
| 201 | 201 | {
|
| 202 | - if(!isset($aHookMethods[$sCalledMethod])) |
|
| 202 | + if (!isset($aHookMethods[$sCalledMethod])) |
|
| 203 | 203 | {
|
| 204 | 204 | $aHookMethods[$sCalledMethod] = []; |
| 205 | 205 | } |
| 206 | - if(is_array($xMethodToCall)) |
|
| 206 | + if (is_array($xMethodToCall)) |
|
| 207 | 207 | {
|
| 208 | 208 | $aHookMethods[$sCalledMethod] = array_merge($aHookMethods[$sCalledMethod], $xMethodToCall); |
| 209 | 209 | } |
| 210 | - elseif(is_string($xMethodToCall)) |
|
| 210 | + elseif (is_string($xMethodToCall)) |
|
| 211 | 211 | {
|
| 212 | 212 | $aHookMethods[$sCalledMethod][] = $xMethodToCall; |
| 213 | 213 | } |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | */ |
| 233 | 233 | private function addOption(string $sName, $xValue) |
| 234 | 234 | {
|
| 235 | - switch($sName) |
|
| 235 | + switch ($sName) |
|
| 236 | 236 | {
|
| 237 | 237 | // Set the methods to call before processing the request |
| 238 | 238 | case '__before': |
@@ -260,11 +260,11 @@ discard block |
||
| 260 | 260 | */ |
| 261 | 261 | private function _addJsArrayOption(string $sFunctionName, string $sOptionName, $xOptionValue) |
| 262 | 262 | {
|
| 263 | - if(is_string($xOptionValue)) |
|
| 263 | + if (is_string($xOptionValue)) |
|
| 264 | 264 | {
|
| 265 | 265 | $xOptionValue = [$xOptionValue]; |
| 266 | 266 | } |
| 267 | - if(!is_array($xOptionValue)) |
|
| 267 | + if (!is_array($xOptionValue)) |
|
| 268 | 268 | {
|
| 269 | 269 | return; // Do not save. |
| 270 | 270 | } |
@@ -293,10 +293,10 @@ discard block |
||
| 293 | 293 | */ |
| 294 | 294 | private function addJsOption(string $sFunctionName, string $sOptionName, $xOptionValue) |
| 295 | 295 | {
|
| 296 | - switch($sOptionName) |
|
| 296 | + switch ($sOptionName) |
|
| 297 | 297 | {
|
| 298 | 298 | case 'excluded': |
| 299 | - if((bool)$xOptionValue) |
|
| 299 | + if ((bool) $xOptionValue) |
|
| 300 | 300 | {
|
| 301 | 301 | $this->addProtectedMethods($sFunctionName); |
| 302 | 302 | } |
@@ -320,12 +320,11 @@ discard block |
||
| 320 | 320 | */ |
| 321 | 321 | private function addFunctionOptions(string $sFunctionName, array $aFunctionOptions) |
| 322 | 322 | {
|
| 323 | - foreach($aFunctionOptions as $sOptionName => $xOptionValue) |
|
| 323 | + foreach ($aFunctionOptions as $sOptionName => $xOptionValue) |
|
| 324 | 324 | {
|
| 325 | 325 | substr($sOptionName, 0, 2) === '__' ? |
| 326 | 326 | // Options for PHP classes. They start with "__". |
| 327 | - $this->addOption($sOptionName, [$sFunctionName => $xOptionValue]) : |
|
| 328 | - // Options for javascript code. |
|
| 327 | + $this->addOption($sOptionName, [$sFunctionName => $xOptionValue]) : // Options for javascript code. |
|
| 329 | 328 | $this->addJsOption($sFunctionName, $sOptionName, $xOptionValue); |
| 330 | 329 | } |
| 331 | 330 | } |
@@ -341,12 +340,11 @@ discard block |
||
| 341 | 340 | $aOptions = array_merge($this->aJsOptions['*'] ?? []); // Clone the array |
| 342 | 341 | // Then add the method options. |
| 343 | 342 | $aMethodOptions = $this->aJsOptions[$sMethodName] ?? []; |
| 344 | - foreach($aMethodOptions as $sOptionName => $xOptionValue) |
|
| 343 | + foreach ($aMethodOptions as $sOptionName => $xOptionValue) |
|
| 345 | 344 | {
|
| 346 | 345 | // For databags, merge the values in a single array. |
| 347 | 346 | // For all the other options, including callback, keep the last value. |
| 348 | - $aOptions[$sOptionName] = $sOptionName !== 'bags' ? $xOptionValue : |
|
| 349 | - array_unique(array_merge($aOptions[$sOptionName] ?? [], $xOptionValue)); |
|
| 347 | + $aOptions[$sOptionName] = $sOptionName !== 'bags' ? $xOptionValue : array_unique(array_merge($aOptions[$sOptionName] ?? [], $xOptionValue)); |
|
| 350 | 348 | } |
| 351 | 349 | return $aOptions; |
| 352 | 350 | } |
@@ -206,8 +206,7 @@ |
||
| 206 | 206 | if(is_array($xMethodToCall)) |
| 207 | 207 | {
|
| 208 | 208 | $aHookMethods[$sCalledMethod] = array_merge($aHookMethods[$sCalledMethod], $xMethodToCall); |
| 209 | - } |
|
| 210 | - elseif(is_string($xMethodToCall)) |
|
| 209 | + } elseif(is_string($xMethodToCall)) |
|
| 211 | 210 | {
|
| 212 | 211 | $aHookMethods[$sCalledMethod][] = $xMethodToCall; |
| 213 | 212 | } |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | public function getOutput(): string |
| 88 | 88 | {
|
| 89 | - if($this->getCommandCount() === 0) |
|
| 89 | + if ($this->getCommandCount() === 0) |
|
| 90 | 90 | {
|
| 91 | 91 | return '{}';
|
| 92 | 92 | } |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | public function addCommand(array $aAttributes, $mData): ResponseInterface |
| 176 | 176 | {
|
| 177 | 177 | $aAttributes = array_map(function($xAttribute) {
|
| 178 | - return is_integer($xAttribute) ? $xAttribute : trim((string)$xAttribute, " \t"); |
|
| 178 | + return is_integer($xAttribute) ? $xAttribute : trim((string) $xAttribute, " \t"); |
|
| 179 | 179 | }, $aAttributes); |
| 180 | 180 | return $this->addRawCommand($aAttributes, $mData); |
| 181 | 181 | } |
@@ -194,9 +194,9 @@ discard block |
||
| 194 | 194 | $mData, bool $bRemoveEmpty = false): ResponseInterface |
| 195 | 195 | {
|
| 196 | 196 | $mData = is_array($mData) ? array_map(function($sData) {
|
| 197 | - return trim((string)$sData, " \t\n"); |
|
| 198 | - }, $mData) : trim((string)$mData, " \t\n"); |
|
| 199 | - if($bRemoveEmpty) |
|
| 197 | + return trim((string) $sData, " \t\n"); |
|
| 198 | + }, $mData) : trim((string) $mData, " \t\n"); |
|
| 199 | + if ($bRemoveEmpty) |
|
| 200 | 200 | {
|
| 201 | 201 | $aAttributes = array_filter($aAttributes, function($xValue) {
|
| 202 | 202 | return $xValue === ''; |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | public function toPsr(): PsrResponseInterface |
| 230 | 230 | {
|
| 231 | 231 | $xPsrResponse = $this->xPsr17Factory->createResponse(200); |
| 232 | - if($this->xRequest->getMethod() === 'GET') |
|
| 232 | + if ($this->xRequest->getMethod() === 'GET') |
|
| 233 | 233 | {
|
| 234 | 234 | $xPsrResponse = $xPsrResponse |
| 235 | 235 | ->withHeader('Expires', 'Mon, 26 Jul 1997 05:00:00 GMT')
|
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | */ |
| 215 | 215 | public function set(string $sClass, Closure $xClosure) |
| 216 | 216 | {
|
| 217 | - $this->xLibContainer->offsetSet($sClass, function() use($xClosure) {
|
|
| 217 | + $this->xLibContainer->offsetSet($sClass, function() use($xClosure) {
|
|
| 218 | 218 | return $xClosure($this); |
| 219 | 219 | }); |
| 220 | 220 | } |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | */ |
| 230 | 230 | public function val(string $sKey, $xValue) |
| 231 | 231 | {
|
| 232 | - $this->xLibContainer->offsetSet($sKey, $xValue); |
|
| 232 | + $this->xLibContainer->offsetSet($sKey, $xValue); |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | /** |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | */ |
| 158 | 158 | public function has(string $sClass): bool |
| 159 | 159 | {
|
| 160 | - if($this->xAppContainer != null && $this->xAppContainer->has($sClass)) |
|
| 160 | + if ($this->xAppContainer != null && $this->xAppContainer->has($sClass)) |
|
| 161 | 161 | {
|
| 162 | 162 | return true; |
| 163 | 163 | } |
@@ -188,13 +188,13 @@ discard block |
||
| 188 | 188 | {
|
| 189 | 189 | try |
| 190 | 190 | {
|
| 191 | - if($this->xAppContainer != null && $this->xAppContainer->has($sClass)) |
|
| 191 | + if ($this->xAppContainer != null && $this->xAppContainer->has($sClass)) |
|
| 192 | 192 | {
|
| 193 | 193 | return $this->xAppContainer->get($sClass); |
| 194 | 194 | } |
| 195 | 195 | return $this->xLibContainer->offsetGet($sClass); |
| 196 | 196 | } |
| 197 | - catch(Exception|Throwable $e) |
|
| 197 | + catch (Exception | Throwable $e) |
|
| 198 | 198 | {
|
| 199 | 199 | $xLogger = $this->g(LoggerInterface::class); |
| 200 | 200 | $xTranslator = $this->g(Translator::class); |
@@ -258,15 +258,15 @@ discard block |
||
| 258 | 258 | {
|
| 259 | 259 | $xType = $xParameter->getType(); |
| 260 | 260 | // Check the parameter class first. |
| 261 | - if($xType instanceof ReflectionNamedType) |
|
| 261 | + if ($xType instanceof ReflectionNamedType) |
|
| 262 | 262 | {
|
| 263 | 263 | // Check the class + the name |
| 264 | - if($this->has($xType->getName() . ' $' . $xParameter->getName())) |
|
| 264 | + if ($this->has($xType->getName() . ' $' . $xParameter->getName())) |
|
| 265 | 265 | {
|
| 266 | 266 | return $this->get($xType->getName() . ' $' . $xParameter->getName()); |
| 267 | 267 | } |
| 268 | 268 | // Check the class only |
| 269 | - if($this->get($xType->getName())) |
|
| 269 | + if ($this->get($xType->getName())) |
|
| 270 | 270 | {
|
| 271 | 271 | return $this->get($xType->getName()); |
| 272 | 272 | } |
@@ -286,16 +286,16 @@ discard block |
||
| 286 | 286 | */ |
| 287 | 287 | public function make($xClass) |
| 288 | 288 | {
|
| 289 | - if(is_string($xClass)) |
|
| 289 | + if (is_string($xClass)) |
|
| 290 | 290 | {
|
| 291 | 291 | $xClass = new ReflectionClass($xClass); // Create the reflection class instance |
| 292 | 292 | } |
| 293 | - if(!($xClass instanceof ReflectionClass)) |
|
| 293 | + if (!($xClass instanceof ReflectionClass)) |
|
| 294 | 294 | {
|
| 295 | 295 | return null; |
| 296 | 296 | } |
| 297 | 297 | // Use the Reflection class to get the parameters of the constructor |
| 298 | - if(($constructor = $xClass->getConstructor()) === null) |
|
| 298 | + if (($constructor = $xClass->getConstructor()) === null) |
|
| 299 | 299 | {
|
| 300 | 300 | return $xClass->newInstance(); |
| 301 | 301 | } |
@@ -193,8 +193,7 @@ |
||
| 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); |
@@ -134,23 +134,23 @@ discard block |
||
| 134 | 134 | */ |
| 135 | 135 | public static function make($xValue): ParameterInterface |
| 136 | 136 | {
|
| 137 | - if($xValue instanceof ParameterInterface) |
|
| 137 | + if ($xValue instanceof ParameterInterface) |
|
| 138 | 138 | {
|
| 139 | 139 | return $xValue; |
| 140 | 140 | } |
| 141 | - if(is_numeric($xValue)) |
|
| 141 | + if (is_numeric($xValue)) |
|
| 142 | 142 | {
|
| 143 | 143 | return new Parameter(self::NUMERIC_VALUE, $xValue); |
| 144 | 144 | } |
| 145 | - if(is_string($xValue)) |
|
| 145 | + if (is_string($xValue)) |
|
| 146 | 146 | {
|
| 147 | 147 | return new Parameter(self::QUOTED_VALUE, $xValue); |
| 148 | 148 | } |
| 149 | - if(is_bool($xValue)) |
|
| 149 | + if (is_bool($xValue)) |
|
| 150 | 150 | {
|
| 151 | 151 | return new Parameter(self::BOOL_VALUE, $xValue); |
| 152 | 152 | } |
| 153 | - if($xValue instanceof JsCall) |
|
| 153 | + if ($xValue instanceof JsCall) |
|
| 154 | 154 | {
|
| 155 | 155 | return new Parameter(self::JS_CALL, $xValue); |
| 156 | 156 | } |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | */ |
| 253 | 253 | protected function getNumericValueScript(): string |
| 254 | 254 | {
|
| 255 | - return (string)$this->xValue; |
|
| 255 | + return (string) $this->xValue; |
|
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | /** |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | */ |
| 263 | 263 | protected function getUnquotedValueScript(): string |
| 264 | 264 | {
|
| 265 | - return (string)$this->xValue; |
|
| 265 | + return (string) $this->xValue; |
|
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | /** |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | */ |
| 285 | 285 | protected function getPageNumberScript(): string |
| 286 | 286 | {
|
| 287 | - return (string)$this->xValue; |
|
| 287 | + return (string) $this->xValue; |
|
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | /** |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | public function getScript(): string |
| 306 | 306 | {
|
| 307 | 307 | $sMethodName = 'get' . $this->sType . 'Script'; |
| 308 | - if(!method_exists($this, $sMethodName)) |
|
| 308 | + if (!method_exists($this, $sMethodName)) |
|
| 309 | 309 | {
|
| 310 | 310 | return ''; |
| 311 | 311 | } |