@@ -258,8 +258,7 @@ |
||
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | return $this->xMetadata; |
| 261 | - } |
|
| 262 | - catch(Exception|Error $e) |
|
| 261 | + } catch(Exception|Error $e) |
|
| 263 | 262 | { |
| 264 | 263 | throw new SetupException($e->getMessage()); |
| 265 | 264 | } |
@@ -6,7 +6,8 @@ discard block |
||
| 6 | 6 | if(<?php echo $sJsClass ?> === undefined) { |
| 7 | 7 | <?php echo $sJsClass ?> = {}; |
| 8 | 8 | } |
| 9 | -<?php else: ?> |
|
| 9 | +<?php else { |
|
| 10 | + : ?> |
|
| 10 | 11 | <?php echo $sJsClass ?> = {}; |
| 11 | 12 | <?php endif ?> |
| 12 | 13 | <?php foreach($this->aMethods as $aMethod): ?> |
@@ -17,3 +18,4 @@ discard block |
||
| 17 | 18 | echo $sKey ?>: <?php echo $sValue ?><?php endforeach ?> }); |
| 18 | 19 | }; |
| 19 | 20 | <?php endforeach; |
| 21 | +} |
|
@@ -199,8 +199,7 @@ |
||
| 199 | 199 | { |
| 200 | 200 | return $this->xAppContainer != null && $this->xAppContainer->has($sClass) ? |
| 201 | 201 | $this->xAppContainer->get($sClass) : $this->xLibContainer->offsetGet($sClass); |
| 202 | - } |
|
| 203 | - catch(Exception|Throwable $e) |
|
| 202 | + } catch(Exception|Throwable $e) |
|
| 204 | 203 | { |
| 205 | 204 | $xLogger = $this->g(LoggerInterface::class); |
| 206 | 205 | $xTranslator = $this->g(Translator::class); |
@@ -214,8 +214,7 @@ |
||
| 214 | 214 | if($this->bOnConfirm) |
| 215 | 215 | { |
| 216 | 216 | $this->aConfirmCommands[] = $xCommand; |
| 217 | - } |
|
| 218 | - else |
|
| 217 | + } else |
|
| 219 | 218 | { |
| 220 | 219 | $this->aCommands[] = $xCommand; |
| 221 | 220 | } |
@@ -218,8 +218,7 @@ |
||
| 218 | 218 | { |
| 219 | 219 | // A string is supposed to be the path to a config file. |
| 220 | 220 | $aLibOptions = $this->xConfigManager->read($aLibOptions); |
| 221 | - } |
|
| 222 | - elseif(!is_array($aLibOptions)) |
|
| 221 | + } elseif(!is_array($aLibOptions)) |
|
| 223 | 222 | { |
| 224 | 223 | // Otherwise, anything else than an array is not accepted. |
| 225 | 224 | $sMessage = $this->xTranslator->trans('errors.register.invalid', ['name' => $sClassName]); |
@@ -226,8 +226,7 @@ |
||
| 226 | 226 | if(is_array($xMethodToCall)) |
| 227 | 227 | { |
| 228 | 228 | $aHookMethods[$sCalledMethod] = array_merge($aHookMethods[$sCalledMethod], $xMethodToCall); |
| 229 | - } |
|
| 230 | - elseif(is_string($xMethodToCall)) |
|
| 229 | + } elseif(is_string($xMethodToCall)) |
|
| 231 | 230 | { |
| 232 | 231 | $aHookMethods[$sCalledMethod][] = $xMethodToCall; |
| 233 | 232 | } |
@@ -92,8 +92,7 @@ discard block |
||
| 92 | 92 | if(is_string($xOptions)) |
| 93 | 93 | { |
| 94 | 94 | $xOptions = ['include' => $xOptions]; |
| 95 | - } |
|
| 96 | - elseif(!is_array($xOptions)) |
|
| 95 | + } elseif(!is_array($xOptions)) |
|
| 97 | 96 | { |
| 98 | 97 | throw new SetupException($this->xTranslator->trans('errors.objects.invalid-declaration')); |
| 99 | 98 | } |
@@ -236,8 +235,7 @@ discard block |
||
| 236 | 235 | { |
| 237 | 236 | /** @var CallableFunction */ |
| 238 | 237 | $xFunction = $this->getCallable($sRequestedFunction); |
| 239 | - } |
|
| 240 | - catch(Exception $e) |
|
| 238 | + } catch(Exception $e) |
|
| 241 | 239 | { |
| 242 | 240 | // Unable to find the requested function |
| 243 | 241 | $this->throwException($e, $this->xTranslator->trans('errors.functions.invalid', |
@@ -246,8 +244,7 @@ discard block |
||
| 246 | 244 | try |
| 247 | 245 | { |
| 248 | 246 | $xFunction->call($this->xTarget->args()); |
| 249 | - } |
|
| 250 | - catch(Exception $e) |
|
| 247 | + } catch(Exception $e) |
|
| 251 | 248 | { |
| 252 | 249 | // Unable to execute the requested function |
| 253 | 250 | $this->throwException($e, $this->xTranslator->trans('errors.functions.call', |
@@ -42,21 +42,21 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | class CallableFunctionPlugin extends AbstractRequestPlugin |
| 44 | 44 | { |
| 45 | - /** |
|
| 45 | +/** |
|
| 46 | 46 | * The registered functions names |
| 47 | 47 | * |
| 48 | 48 | * @var array |
| 49 | 49 | */ |
| 50 | - protected $aFunctions = []; |
|
| 50 | +protected $aFunctions = []; |
|
| 51 | 51 | |
| 52 | - /** |
|
| 52 | +/** |
|
| 53 | 53 | * The registered functions options |
| 54 | 54 | * |
| 55 | 55 | * @var array |
| 56 | 56 | */ |
| 57 | - protected $aOptions = []; |
|
| 57 | +protected $aOptions = []; |
|
| 58 | 58 | |
| 59 | - /** |
|
| 59 | +/** |
|
| 60 | 60 | * The constructor |
| 61 | 61 | * |
| 62 | 62 | * @param string $sPrefix |
@@ -66,41 +66,41 @@ discard block |
||
| 66 | 66 | * @param Translator $xTranslator |
| 67 | 67 | * @param Validator $xValidator |
| 68 | 68 | */ |
| 69 | - public function __construct(private string $sPrefix, private bool $bDebug, |
|
| 70 | - private Container $di, private TemplateEngine $xTemplateEngine, |
|
| 71 | - private Translator $xTranslator, private Validator $xValidator) |
|
| 72 | - {} |
|
| 69 | +public function __construct(private string $sPrefix, private bool $bDebug, |
|
| 70 | +private Container $di, private TemplateEngine $xTemplateEngine, |
|
| 71 | +private Translator $xTranslator, private Validator $xValidator) |
|
| 72 | +{} |
|
| 73 | 73 | |
| 74 | - /** |
|
| 74 | +/** |
|
| 75 | 75 | * @inheritDoc |
| 76 | 76 | */ |
| 77 | - public function getName(): string |
|
| 78 | - { |
|
| 79 | - return Jaxon::CALLABLE_FUNCTION; |
|
| 80 | - } |
|
| 77 | +public function getName(): string |
|
| 78 | +{ |
|
| 79 | +return Jaxon::CALLABLE_FUNCTION; |
|
| 80 | +} |
|
| 81 | 81 | |
| 82 | - /** |
|
| 82 | +/** |
|
| 83 | 83 | * @inheritDoc |
| 84 | 84 | * @throws SetupException |
| 85 | 85 | */ |
| 86 | - public function checkOptions(string $sCallable, $xOptions): array |
|
| 87 | - { |
|
| 88 | - if(!$this->xValidator->validateFunction(trim($sCallable))) |
|
| 89 | - { |
|
| 90 | - throw new SetupException($this->xTranslator->trans('errors.objects.invalid-declaration')); |
|
| 91 | - } |
|
| 92 | - if(is_string($xOptions)) |
|
| 93 | - { |
|
| 94 | - $xOptions = ['include' => $xOptions]; |
|
| 95 | - } |
|
| 96 | - elseif(!is_array($xOptions)) |
|
| 97 | - { |
|
| 98 | - throw new SetupException($this->xTranslator->trans('errors.objects.invalid-declaration')); |
|
| 99 | - } |
|
| 100 | - return $xOptions; |
|
| 101 | - } |
|
| 86 | +public function checkOptions(string $sCallable, $xOptions): array |
|
| 87 | +{ |
|
| 88 | +if(!$this->xValidator->validateFunction(trim($sCallable))) |
|
| 89 | +{ |
|
| 90 | +throw new SetupException($this->xTranslator->trans('errors.objects.invalid-declaration')); |
|
| 91 | +} |
|
| 92 | +if(is_string($xOptions)) |
|
| 93 | +{ |
|
| 94 | +$xOptions = ['include' => $xOptions]; |
|
| 95 | +} |
|
| 96 | +elseif(!is_array($xOptions)) |
|
| 97 | +{ |
|
| 98 | +throw new SetupException($this->xTranslator->trans('errors.objects.invalid-declaration')); |
|
| 99 | +} |
|
| 100 | +return $xOptions; |
|
| 101 | +} |
|
| 102 | 102 | |
| 103 | - /** |
|
| 103 | +/** |
|
| 104 | 104 | * Register a user defined function |
| 105 | 105 | * |
| 106 | 106 | * @param string $sType The type of request handler being registered |
@@ -109,149 +109,149 @@ discard block |
||
| 109 | 109 | * |
| 110 | 110 | * @return bool |
| 111 | 111 | */ |
| 112 | - public function register(string $sType, string $sCallable, array $aOptions): bool |
|
| 113 | - { |
|
| 114 | - $sPhpFunction = trim($sCallable); |
|
| 115 | - $sFunction = $sPhpFunction; |
|
| 116 | - // Check if an alias is defined |
|
| 117 | - if(isset($aOptions['alias'])) |
|
| 118 | - { |
|
| 119 | - $sFunction = (string)$aOptions['alias']; |
|
| 120 | - unset($aOptions['alias']); |
|
| 121 | - } |
|
| 122 | - $this->aFunctions[$sFunction] = $sPhpFunction; |
|
| 123 | - $this->aOptions[$sFunction] = $aOptions; |
|
| 124 | - return true; |
|
| 125 | - } |
|
| 112 | +public function register(string $sType, string $sCallable, array $aOptions): bool |
|
| 113 | +{ |
|
| 114 | +$sPhpFunction = trim($sCallable); |
|
| 115 | +$sFunction = $sPhpFunction; |
|
| 116 | +// Check if an alias is defined |
|
| 117 | +if(isset($aOptions['alias'])) |
|
| 118 | +{ |
|
| 119 | +$sFunction = (string)$aOptions['alias']; |
|
| 120 | +unset($aOptions['alias']); |
|
| 121 | +} |
|
| 122 | +$this->aFunctions[$sFunction] = $sPhpFunction; |
|
| 123 | +$this->aOptions[$sFunction] = $aOptions; |
|
| 124 | +return true; |
|
| 125 | +} |
|
| 126 | 126 | |
| 127 | - /** |
|
| 127 | +/** |
|
| 128 | 128 | * @inheritDoc |
| 129 | 129 | */ |
| 130 | - public function getHash(): string |
|
| 131 | - { |
|
| 132 | - return md5(implode('', array_keys($this->aFunctions))); |
|
| 133 | - } |
|
| 130 | +public function getHash(): string |
|
| 131 | +{ |
|
| 132 | +return md5(implode('', array_keys($this->aFunctions))); |
|
| 133 | +} |
|
| 134 | 134 | |
| 135 | - /** |
|
| 135 | +/** |
|
| 136 | 136 | * @inheritDoc |
| 137 | 137 | */ |
| 138 | - public function getCallable(string $sCallable): CallableFunction|null |
|
| 139 | - { |
|
| 140 | - $sFunction = trim($sCallable); |
|
| 141 | - if(!isset($this->aFunctions[$sFunction])) |
|
| 142 | - { |
|
| 143 | - return null; |
|
| 144 | - } |
|
| 145 | - $xCallable = new CallableFunction($this->di, $sFunction, |
|
| 146 | - $this->sPrefix . $sFunction, $this->aFunctions[$sFunction]); |
|
| 147 | - foreach($this->aOptions[$sFunction] as $sName => $sValue) |
|
| 148 | - { |
|
| 149 | - $xCallable->configure($sName, $sValue); |
|
| 150 | - } |
|
| 151 | - return $xCallable; |
|
| 152 | - } |
|
| 138 | +public function getCallable(string $sCallable): CallableFunction|null |
|
| 139 | +{ |
|
| 140 | +$sFunction = trim($sCallable); |
|
| 141 | +if(!isset($this->aFunctions[$sFunction])) |
|
| 142 | +{ |
|
| 143 | +return null; |
|
| 144 | +} |
|
| 145 | +$xCallable = new CallableFunction($this->di, $sFunction, |
|
| 146 | +$this->sPrefix . $sFunction, $this->aFunctions[$sFunction]); |
|
| 147 | +foreach($this->aOptions[$sFunction] as $sName => $sValue) |
|
| 148 | +{ |
|
| 149 | +$xCallable->configure($sName, $sValue); |
|
| 150 | +} |
|
| 151 | +return $xCallable; |
|
| 152 | +} |
|
| 153 | 153 | |
| 154 | - /** |
|
| 154 | +/** |
|
| 155 | 155 | * Generate the javascript function stub that is sent to the browser on initial page load |
| 156 | 156 | * |
| 157 | 157 | * @param CallableFunction $xFunction |
| 158 | 158 | * |
| 159 | 159 | * @return string |
| 160 | 160 | */ |
| 161 | - private function getCallableScript(CallableFunction $xFunction): string |
|
| 162 | - { |
|
| 163 | - return $this->xTemplateEngine->render('jaxon::callables/function.js', [ |
|
| 164 | - 'sName' => $xFunction->getName(), |
|
| 165 | - 'sJsName' => $xFunction->getJsName(), |
|
| 166 | - 'aOptions' => $xFunction->getOptions(), |
|
| 167 | - ]); |
|
| 168 | - } |
|
| 161 | +private function getCallableScript(CallableFunction $xFunction): string |
|
| 162 | +{ |
|
| 163 | +return $this->xTemplateEngine->render('jaxon::callables/function.js', [ |
|
| 164 | +'sName' => $xFunction->getName(), |
|
| 165 | +'sJsName' => $xFunction->getJsName(), |
|
| 166 | +'aOptions' => $xFunction->getOptions(), |
|
| 167 | +]); |
|
| 168 | +} |
|
| 169 | 169 | |
| 170 | - /** |
|
| 170 | +/** |
|
| 171 | 171 | * @inheritDoc |
| 172 | 172 | */ |
| 173 | - public function getScript(): string |
|
| 174 | - { |
|
| 175 | - $code = ''; |
|
| 176 | - foreach(array_keys($this->aFunctions) as $sFunction) |
|
| 177 | - { |
|
| 178 | - $xFunction = $this->getCallable($sFunction); |
|
| 179 | - $code .= $this->getCallableScript($xFunction); |
|
| 180 | - } |
|
| 181 | - return $code; |
|
| 182 | - } |
|
| 173 | +public function getScript(): string |
|
| 174 | +{ |
|
| 175 | +$code = ''; |
|
| 176 | +foreach(array_keys($this->aFunctions) as $sFunction) |
|
| 177 | +{ |
|
| 178 | +$xFunction = $this->getCallable($sFunction); |
|
| 179 | +$code .= $this->getCallableScript($xFunction); |
|
| 180 | +} |
|
| 181 | +return $code; |
|
| 182 | +} |
|
| 183 | 183 | |
| 184 | - /** |
|
| 184 | +/** |
|
| 185 | 185 | * @inheritDoc |
| 186 | 186 | */ |
| 187 | - public static function canProcessRequest(ServerRequestInterface $xRequest): bool |
|
| 188 | - { |
|
| 189 | - $aCall = $xRequest->getAttribute('jxncall'); |
|
| 190 | - // throw new \Exception(json_encode(['call' => $aCall])); |
|
| 191 | - return $aCall !== null && ($aCall['type'] ?? '') === 'func' && isset($aCall['name']); |
|
| 192 | - } |
|
| 187 | +public static function canProcessRequest(ServerRequestInterface $xRequest): bool |
|
| 188 | +{ |
|
| 189 | +$aCall = $xRequest->getAttribute('jxncall'); |
|
| 190 | +// throw new \Exception(json_encode(['call' => $aCall])); |
|
| 191 | +return $aCall !== null && ($aCall['type'] ?? '') === 'func' && isset($aCall['name']); |
|
| 192 | +} |
|
| 193 | 193 | |
| 194 | - /** |
|
| 194 | +/** |
|
| 195 | 195 | * @inheritDoc |
| 196 | 196 | */ |
| 197 | - public function setTarget(ServerRequestInterface $xRequest): Target |
|
| 198 | - { |
|
| 199 | - $aCall = $xRequest->getAttribute('jxncall'); |
|
| 200 | - $this->xTarget = Target::makeFunction(trim($aCall['name'])); |
|
| 201 | - return $this->xTarget; |
|
| 202 | - } |
|
| 197 | +public function setTarget(ServerRequestInterface $xRequest): Target |
|
| 198 | +{ |
|
| 199 | +$aCall = $xRequest->getAttribute('jxncall'); |
|
| 200 | +$this->xTarget = Target::makeFunction(trim($aCall['name'])); |
|
| 201 | +return $this->xTarget; |
|
| 202 | +} |
|
| 203 | 203 | |
| 204 | - /** |
|
| 204 | +/** |
|
| 205 | 205 | * @param Exception $xException |
| 206 | 206 | * @param string $sErrorMessage |
| 207 | 207 | * |
| 208 | 208 | * @throws RequestException |
| 209 | 209 | * @return void |
| 210 | 210 | */ |
| 211 | - private function throwException(Exception $xException, string $sErrorMessage): void |
|
| 212 | - { |
|
| 213 | - $this->di->getLogger()->error($xException->getMessage()); |
|
| 214 | - throw new RequestException($sErrorMessage . (!$this->bDebug ? '' : |
|
| 215 | - "\n" . $xException->getMessage())); |
|
| 216 | - } |
|
| 211 | +private function throwException(Exception $xException, string $sErrorMessage): void |
|
| 212 | +{ |
|
| 213 | +$this->di->getLogger()->error($xException->getMessage()); |
|
| 214 | +throw new RequestException($sErrorMessage . (!$this->bDebug ? '' : |
|
| 215 | +"\n" . $xException->getMessage())); |
|
| 216 | +} |
|
| 217 | 217 | |
| 218 | - /** |
|
| 218 | +/** |
|
| 219 | 219 | * @inheritDoc |
| 220 | 220 | * @throws RequestException |
| 221 | 221 | */ |
| 222 | - public function processRequest(): void |
|
| 223 | - { |
|
| 224 | - $sRequestedFunction = $this->xTarget->getFunctionName(); |
|
| 222 | +public function processRequest(): void |
|
| 223 | +{ |
|
| 224 | +$sRequestedFunction = $this->xTarget->getFunctionName(); |
|
| 225 | 225 | |
| 226 | - // Security check: make sure the requested function was registered. |
|
| 227 | - if(!$this->xValidator->validateFunction($sRequestedFunction) || |
|
| 228 | - !isset($this->aFunctions[$sRequestedFunction])) |
|
| 229 | - { |
|
| 230 | - // Unable to find the requested function |
|
| 231 | - throw new RequestException($this->xTranslator->trans('errors.functions.invalid', |
|
| 232 | - ['name' => $sRequestedFunction])); |
|
| 233 | - } |
|
| 226 | +// Security check: make sure the requested function was registered. |
|
| 227 | +if(!$this->xValidator->validateFunction($sRequestedFunction) || |
|
| 228 | +!isset($this->aFunctions[$sRequestedFunction])) |
|
| 229 | +{ |
|
| 230 | +// Unable to find the requested function |
|
| 231 | +throw new RequestException($this->xTranslator->trans('errors.functions.invalid', |
|
| 232 | + ['name' => $sRequestedFunction])); |
|
| 233 | +} |
|
| 234 | 234 | |
| 235 | - try |
|
| 236 | - { |
|
| 237 | - /** @var CallableFunction */ |
|
| 238 | - $xFunction = $this->getCallable($sRequestedFunction); |
|
| 239 | - } |
|
| 240 | - catch(Exception $e) |
|
| 241 | - { |
|
| 242 | - // Unable to find the requested function |
|
| 243 | - $this->throwException($e, $this->xTranslator->trans('errors.functions.invalid', |
|
| 244 | - ['name' => $sRequestedFunction])); |
|
| 245 | - } |
|
| 246 | - try |
|
| 247 | - { |
|
| 248 | - $xFunction->call($this->xTarget->args()); |
|
| 249 | - } |
|
| 250 | - catch(Exception $e) |
|
| 251 | - { |
|
| 252 | - // Unable to execute the requested function |
|
| 253 | - $this->throwException($e, $this->xTranslator->trans('errors.functions.call', |
|
| 254 | - ['name' => $sRequestedFunction])); |
|
| 255 | - } |
|
| 256 | - } |
|
| 235 | +try |
|
| 236 | +{ |
|
| 237 | +/** @var CallableFunction */ |
|
| 238 | +$xFunction = $this->getCallable($sRequestedFunction); |
|
| 239 | +} |
|
| 240 | +catch(Exception $e) |
|
| 241 | +{ |
|
| 242 | +// Unable to find the requested function |
|
| 243 | +$this->throwException($e, $this->xTranslator->trans('errors.functions.invalid', |
|
| 244 | + ['name' => $sRequestedFunction])); |
|
| 245 | +} |
|
| 246 | +try |
|
| 247 | +{ |
|
| 248 | +$xFunction->call($this->xTarget->args()); |
|
| 249 | +} |
|
| 250 | +catch(Exception $e) |
|
| 251 | +{ |
|
| 252 | +// Unable to execute the requested function |
|
| 253 | +$this->throwException($e, $this->xTranslator->trans('errors.functions.call', |
|
| 254 | + ['name' => $sRequestedFunction])); |
|
| 255 | +} |
|
| 256 | +} |
|
| 257 | 257 | } |
@@ -69,23 +69,19 @@ discard block |
||
| 69 | 69 | try |
| 70 | 70 | { |
| 71 | 71 | return $this->xConfigReader->read($sConfigFile); |
| 72 | - } |
|
| 73 | - catch(YamlExtension $e) |
|
| 72 | + } catch(YamlExtension $e) |
|
| 74 | 73 | { |
| 75 | 74 | $sMessage = $this->xTranslator->trans('errors.yaml.install'); |
| 76 | 75 | throw new SetupException($sMessage); |
| 77 | - } |
|
| 78 | - catch(FileExtension $e) |
|
| 76 | + } catch(FileExtension $e) |
|
| 79 | 77 | { |
| 80 | 78 | $sMessage = $this->xTranslator->trans('errors.file.extension', ['path' => $sConfigFile]); |
| 81 | 79 | throw new SetupException($sMessage); |
| 82 | - } |
|
| 83 | - catch(FileAccess $e) |
|
| 80 | + } catch(FileAccess $e) |
|
| 84 | 81 | { |
| 85 | 82 | $sMessage = $this->xTranslator->trans('errors.file.access', ['path' => $sConfigFile]); |
| 86 | 83 | throw new SetupException($sMessage); |
| 87 | - } |
|
| 88 | - catch(FileContent $e) |
|
| 84 | + } catch(FileContent $e) |
|
| 89 | 85 | { |
| 90 | 86 | $sMessage = $this->xTranslator->trans('errors.file.content', ['path' => $sConfigFile]); |
| 91 | 87 | throw new SetupException($sMessage); |
@@ -110,8 +106,7 @@ discard block |
||
| 110 | 106 | ->setOptions($this->xLibConfig, $this->read($sConfigFile), $sConfigSection); |
| 111 | 107 | // Call the config change listeners. |
| 112 | 108 | $this->xEventManager->libConfigChanged($this->xLibConfig, ''); |
| 113 | - } |
|
| 114 | - catch(DataDepth $e) |
|
| 109 | + } catch(DataDepth $e) |
|
| 115 | 110 | { |
| 116 | 111 | $sMessage = $this->xTranslator->trans('errors.data.depth', [ |
| 117 | 112 | 'key' => $e->sPrefix, |
@@ -139,8 +134,7 @@ discard block |
||
| 139 | 134 | // Call the config change listeners. |
| 140 | 135 | $this->xEventManager->libConfigChanged($this->xLibConfig, ''); |
| 141 | 136 | return $this->xLibConfig->changed(); |
| 142 | - } |
|
| 143 | - catch(DataDepth $e) |
|
| 137 | + } catch(DataDepth $e) |
|
| 144 | 138 | { |
| 145 | 139 | $sMessage = $this->xTranslator->trans('errors.data.depth', [ |
| 146 | 140 | 'key' => $e->sPrefix, |
@@ -246,8 +240,7 @@ discard block |
||
| 246 | 240 | // Call the config change listeners. |
| 247 | 241 | $this->xEventManager->appConfigChanged($this->xAppConfig, ''); |
| 248 | 242 | return $this->xAppConfig->changed(); |
| 249 | - } |
|
| 250 | - catch(DataDepth $e) |
|
| 243 | + } catch(DataDepth $e) |
|
| 251 | 244 | { |
| 252 | 245 | $sMessage = $this->xTranslator->trans('errors.data.depth', [ |
| 253 | 246 | 'key' => $e->sPrefix, |
@@ -296,8 +289,7 @@ discard block |
||
| 296 | 289 | try |
| 297 | 290 | { |
| 298 | 291 | return $this->xConfigSetter->newConfig($aOptions, $sNamePrefix); |
| 299 | - } |
|
| 300 | - catch(DataDepth $e) |
|
| 292 | + } catch(DataDepth $e) |
|
| 301 | 293 | { |
| 302 | 294 | $sMessage = $this->xTranslator->trans('errors.data.depth', [ |
| 303 | 295 | 'key' => $e->sPrefix, |
@@ -203,12 +203,12 @@ |
||
| 203 | 203 | $sCode = match($sType) { |
| 204 | 204 | 'html' => jaxon()->package($sClass)?->getHtml() ?? '', |
| 205 | 205 | 'ready' => jaxon()->package($sClass)?->getReadyScript() ?? '', |
| 206 | - default => '' |
|
| 207 | - }; |
|
| 208 | - $sCode = trim($sCode); |
|
| 206 | +default => '' |
|
| 207 | +}; |
|
| 208 | +$sCode = trim($sCode); |
|
| 209 | 209 | |
| 210 | - return $sType !== 'ready' || $sCode === '' ? $sCode : |
|
| 211 | - // Call the ready code with the jaxon.dom.ready function. |
|
| 212 | - "jaxon.dom.ready(() => $sCode)"; |
|
| 213 | - } |
|
| 210 | +return $sType !== 'ready' || $sCode === '' ? $sCode : |
|
| 211 | +// Call the ready code with the jaxon.dom.ready function. |
|
| 212 | +"jaxon.dom.ready(() => $sCode)"; |
|
| 213 | +} |
|
| 214 | 214 | } |