@@ -127,8 +127,7 @@ discard block |
||
| 127 | 127 | { |
| 128 | 128 | // Register a function without options |
| 129 | 129 | $this->xPluginManager->registerCallable($sCallableType, $xValue); |
| 130 | - } |
|
| 131 | - elseif(is_string($xKey) && (is_array($xValue) || is_string($xValue))) |
|
| 130 | + } elseif(is_string($xKey) && (is_array($xValue) || is_string($xValue))) |
|
| 132 | 131 | { |
| 133 | 132 | // Register a function with options |
| 134 | 133 | $this->xPluginManager->registerCallable($sCallableType, $xKey, $xValue); |
@@ -175,8 +174,7 @@ discard block |
||
| 175 | 174 | { |
| 176 | 175 | // A string is supposed to be the path to a config file. |
| 177 | 176 | $aLibOptions = $this->xConfigManager->read($aLibOptions); |
| 178 | - } |
|
| 179 | - elseif(!is_array($aLibOptions)) |
|
| 177 | + } elseif(!is_array($aLibOptions)) |
|
| 180 | 178 | { |
| 181 | 179 | // Otherwise, anything else than an array is not accepted. |
| 182 | 180 | $sMessage = $this->xTranslator->trans('errors.register.invalid', ['name' => $sClassName]); |
@@ -103,28 +103,28 @@ discard block |
||
| 103 | 103 | private function updateContainer(Config $xConfig) |
| 104 | 104 | { |
| 105 | 105 | $aOptions = $xConfig->getOption('container.set', []); |
| 106 | - foreach($aOptions as $xKey => $xValue) |
|
| 106 | + foreach ($aOptions as $xKey => $xValue) |
|
| 107 | 107 | { |
| 108 | 108 | // The key is the class name. It must be a string. |
| 109 | - $this->di->set((string)$xKey, $xValue); |
|
| 109 | + $this->di->set((string) $xKey, $xValue); |
|
| 110 | 110 | } |
| 111 | 111 | $aOptions = $xConfig->getOption('container.val', []); |
| 112 | - foreach($aOptions as $xKey => $xValue) |
|
| 112 | + foreach ($aOptions as $xKey => $xValue) |
|
| 113 | 113 | { |
| 114 | 114 | // The key is the class name. It must be a string. |
| 115 | - $this->di->val((string)$xKey, $xValue); |
|
| 115 | + $this->di->val((string) $xKey, $xValue); |
|
| 116 | 116 | } |
| 117 | 117 | $aOptions = $xConfig->getOption('container.auto', []); |
| 118 | - foreach($aOptions as $xValue) |
|
| 118 | + foreach ($aOptions as $xValue) |
|
| 119 | 119 | { |
| 120 | 120 | // The key is the class name. It must be a string. |
| 121 | - $this->di->auto((string)$xValue); |
|
| 121 | + $this->di->auto((string) $xValue); |
|
| 122 | 122 | } |
| 123 | 123 | $aOptions = $xConfig->getOption('container.alias', []); |
| 124 | - foreach($aOptions as $xKey => $xValue) |
|
| 124 | + foreach ($aOptions as $xKey => $xValue) |
|
| 125 | 125 | { |
| 126 | 126 | // The key is the class name. It must be a string. |
| 127 | - $this->di->alias((string)$xKey, (string)$xValue); |
|
| 127 | + $this->di->alias((string) $xKey, (string) $xValue); |
|
| 128 | 128 | } |
| 129 | 129 | } |
| 130 | 130 | |
@@ -139,14 +139,14 @@ discard block |
||
| 139 | 139 | */ |
| 140 | 140 | private function registerCallables(array $aOptions, string $sCallableType) |
| 141 | 141 | { |
| 142 | - foreach($aOptions as $xKey => $xValue) |
|
| 142 | + foreach ($aOptions as $xKey => $xValue) |
|
| 143 | 143 | { |
| 144 | - if(is_integer($xKey) && is_string($xValue)) |
|
| 144 | + if (is_integer($xKey) && is_string($xValue)) |
|
| 145 | 145 | { |
| 146 | 146 | // Register a function without options |
| 147 | 147 | $this->xPluginManager->registerCallable($sCallableType, $xValue); |
| 148 | 148 | } |
| 149 | - elseif(is_string($xKey) && (is_array($xValue) || is_string($xValue))) |
|
| 149 | + elseif (is_string($xKey) && (is_array($xValue) || is_string($xValue))) |
|
| 150 | 150 | { |
| 151 | 151 | // Register a function with options |
| 152 | 152 | $this->xPluginManager->registerCallable($sCallableType, $xKey, $xValue); |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | */ |
| 164 | 164 | private function registerExceptionHandlers(Config $xConfig) |
| 165 | 165 | { |
| 166 | - foreach($xConfig->getOption('exceptions', []) as $sExClass => $xExHandler) |
|
| 166 | + foreach ($xConfig->getOption('exceptions', []) as $sExClass => $xExHandler) |
|
| 167 | 167 | { |
| 168 | 168 | $this->xCallbackManager->error($xExHandler, is_string($sExClass) ? $sExClass : ''); |
| 169 | 169 | } |
@@ -206,12 +206,12 @@ discard block |
||
| 206 | 206 | { |
| 207 | 207 | // $this->aPackages contains packages config file paths. |
| 208 | 208 | $aLibOptions = $sClassName::config(); |
| 209 | - if(is_string($aLibOptions)) |
|
| 209 | + if (is_string($aLibOptions)) |
|
| 210 | 210 | { |
| 211 | 211 | // A string is supposed to be the path to a config file. |
| 212 | 212 | $aLibOptions = $this->xConfigManager->read($aLibOptions); |
| 213 | 213 | } |
| 214 | - elseif(!is_array($aLibOptions)) |
|
| 214 | + elseif (!is_array($aLibOptions)) |
|
| 215 | 215 | { |
| 216 | 216 | // Otherwise, anything else than an array is not accepted. |
| 217 | 217 | $sMessage = $this->xTranslator->trans('errors.register.invalid', ['name' => $sClassName]); |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | { |
| 235 | 235 | $xOptionsProvider = $aUserOptions['provider'] ?? null; |
| 236 | 236 | // The user can provide a callable that returns the package options. |
| 237 | - if(is_callable($xOptionsProvider)) |
|
| 237 | + if (is_callable($xOptionsProvider)) |
|
| 238 | 238 | { |
| 239 | 239 | $aUserOptions = $xOptionsProvider($aUserOptions); |
| 240 | 240 | } |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | public function registerPackage(string $sClassName, array $aUserOptions) |
| 254 | 254 | { |
| 255 | 255 | $sClassName = trim($sClassName, '\\ '); |
| 256 | - if(!is_subclass_of($sClassName, Package::class)) |
|
| 256 | + if (!is_subclass_of($sClassName, Package::class)) |
|
| 257 | 257 | { |
| 258 | 258 | $sMessage = $this->xTranslator->trans('errors.register.invalid', ['name' => $sClassName]); |
| 259 | 259 | throw new SetupException($sMessage); |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | |
| 298 | 298 | // Register packages |
| 299 | 299 | $aPackageConfig = $xAppConfig->getOption('packages', []); |
| 300 | - foreach($aPackageConfig as $sClassName => $aPkgOptions) |
|
| 300 | + foreach ($aPackageConfig as $sClassName => $aPkgOptions) |
|
| 301 | 301 | { |
| 302 | 302 | $this->registerPackage($sClassName, $aPkgOptions); |
| 303 | 303 | } |
@@ -56,7 +56,7 @@ |
||
| 56 | 56 | */ |
| 57 | 57 | public function onChange(Config $xConfig, string $sName) |
| 58 | 58 | { |
| 59 | - foreach($this->aListeners as $sListener) |
|
| 59 | + foreach ($this->aListeners as $sListener) |
|
| 60 | 60 | { |
| 61 | 61 | $this->di->g($sListener)->onChange($xConfig, $sName); |
| 62 | 62 | } |
@@ -75,22 +75,22 @@ discard block |
||
| 75 | 75 | { |
| 76 | 76 | return $this->xConfigReader->read($sConfigFile); |
| 77 | 77 | } |
| 78 | - catch(YamlExtension $e) |
|
| 78 | + catch (YamlExtension $e) |
|
| 79 | 79 | { |
| 80 | 80 | $sMessage = $this->xTranslator->trans('errors.yaml.install'); |
| 81 | 81 | throw new SetupException($sMessage); |
| 82 | 82 | } |
| 83 | - catch(FileExtension $e) |
|
| 83 | + catch (FileExtension $e) |
|
| 84 | 84 | { |
| 85 | 85 | $sMessage = $this->xTranslator->trans('errors.file.extension', ['path' => $sConfigFile]); |
| 86 | 86 | throw new SetupException($sMessage); |
| 87 | 87 | } |
| 88 | - catch(FileAccess $e) |
|
| 88 | + catch (FileAccess $e) |
|
| 89 | 89 | { |
| 90 | 90 | $sMessage = $this->xTranslator->trans('errors.file.access', ['path' => $sConfigFile]); |
| 91 | 91 | throw new SetupException($sMessage); |
| 92 | 92 | } |
| 93 | - catch(FileContent $e) |
|
| 93 | + catch (FileContent $e) |
|
| 94 | 94 | { |
| 95 | 95 | $sMessage = $this->xTranslator->trans('errors.file.content', ['path' => $sConfigFile]); |
| 96 | 96 | throw new SetupException($sMessage); |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | // Call the config change listeners. |
| 116 | 116 | $this->xEventManager->onChange($this->xConfig, ''); |
| 117 | 117 | } |
| 118 | - catch(DataDepth $e) |
|
| 118 | + catch (DataDepth $e) |
|
| 119 | 119 | { |
| 120 | 120 | $sMessage = $this->xTranslator->trans('errors.data.depth', |
| 121 | 121 | ['key' => $e->sPrefix, 'depth' => $e->nDepth]); |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | { |
| 137 | 137 | try |
| 138 | 138 | { |
| 139 | - if(!$this->xConfig->setOptions($aOptions, $sKeys)) |
|
| 139 | + if (!$this->xConfig->setOptions($aOptions, $sKeys)) |
|
| 140 | 140 | { |
| 141 | 141 | return false; |
| 142 | 142 | } |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | $this->xEventManager->onChange($this->xConfig, ''); |
| 145 | 145 | return true; |
| 146 | 146 | } |
| 147 | - catch(DataDepth $e) |
|
| 147 | + catch (DataDepth $e) |
|
| 148 | 148 | { |
| 149 | 149 | $sMessage = $this->xTranslator->trans('errors.data.depth', |
| 150 | 150 | ['key' => $e->sPrefix, 'depth' => $e->nDepth]); |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | { |
| 220 | 220 | return new Config($aOptions, $sKeys); |
| 221 | 221 | } |
| 222 | - catch(DataDepth $e) |
|
| 222 | + catch (DataDepth $e) |
|
| 223 | 223 | { |
| 224 | 224 | $sMessage = $this->xTranslator->trans('errors.data.depth', |
| 225 | 225 | ['key' => $e->sPrefix, 'depth' => $e->nDepth]); |
@@ -74,23 +74,19 @@ discard block |
||
| 74 | 74 | try |
| 75 | 75 | { |
| 76 | 76 | return $this->xConfigReader->read($sConfigFile); |
| 77 | - } |
|
| 78 | - catch(YamlExtension $e) |
|
| 77 | + } catch(YamlExtension $e) |
|
| 79 | 78 | { |
| 80 | 79 | $sMessage = $this->xTranslator->trans('errors.yaml.install'); |
| 81 | 80 | throw new SetupException($sMessage); |
| 82 | - } |
|
| 83 | - catch(FileExtension $e) |
|
| 81 | + } catch(FileExtension $e) |
|
| 84 | 82 | { |
| 85 | 83 | $sMessage = $this->xTranslator->trans('errors.file.extension', ['path' => $sConfigFile]); |
| 86 | 84 | throw new SetupException($sMessage); |
| 87 | - } |
|
| 88 | - catch(FileAccess $e) |
|
| 85 | + } catch(FileAccess $e) |
|
| 89 | 86 | { |
| 90 | 87 | $sMessage = $this->xTranslator->trans('errors.file.access', ['path' => $sConfigFile]); |
| 91 | 88 | throw new SetupException($sMessage); |
| 92 | - } |
|
| 93 | - catch(FileContent $e) |
|
| 89 | + } catch(FileContent $e) |
|
| 94 | 90 | { |
| 95 | 91 | $sMessage = $this->xTranslator->trans('errors.file.content', ['path' => $sConfigFile]); |
| 96 | 92 | throw new SetupException($sMessage); |
@@ -114,8 +110,7 @@ discard block |
||
| 114 | 110 | $this->xConfig->setOptions($this->read($sConfigFile), $sConfigSection); |
| 115 | 111 | // Call the config change listeners. |
| 116 | 112 | $this->xEventManager->onChange($this->xConfig, ''); |
| 117 | - } |
|
| 118 | - catch(DataDepth $e) |
|
| 113 | + } catch(DataDepth $e) |
|
| 119 | 114 | { |
| 120 | 115 | $sMessage = $this->xTranslator->trans('errors.data.depth', |
| 121 | 116 | ['key' => $e->sPrefix, 'depth' => $e->nDepth]); |
@@ -143,8 +138,7 @@ discard block |
||
| 143 | 138 | // Call the config change listeners. |
| 144 | 139 | $this->xEventManager->onChange($this->xConfig, ''); |
| 145 | 140 | return true; |
| 146 | - } |
|
| 147 | - catch(DataDepth $e) |
|
| 141 | + } catch(DataDepth $e) |
|
| 148 | 142 | { |
| 149 | 143 | $sMessage = $this->xTranslator->trans('errors.data.depth', |
| 150 | 144 | ['key' => $e->sPrefix, 'depth' => $e->nDepth]); |
@@ -218,8 +212,7 @@ discard block |
||
| 218 | 212 | try |
| 219 | 213 | { |
| 220 | 214 | return new Config($aOptions, $sKeys); |
| 221 | - } |
|
| 222 | - catch(DataDepth $e) |
|
| 215 | + } catch(DataDepth $e) |
|
| 223 | 216 | { |
| 224 | 217 | $sMessage = $this->xTranslator->trans('errors.data.depth', |
| 225 | 218 | ['key' => $e->sPrefix, 'depth' => $e->nDepth]); |
@@ -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 | } |
@@ -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()); |
@@ -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; |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | */ |
| 216 | 216 | private function getCallableScript(CallableObject $xCallableObject): string |
| 217 | 217 | { |
| 218 | - if($xCallableObject->excluded()) |
|
| 218 | + if ($xCallableObject->excluded()) |
|
| 219 | 219 | { |
| 220 | 220 | return ''; |
| 221 | 221 | } |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | public static function canProcessRequest(ServerRequestInterface $xRequest): bool |
| 254 | 254 | { |
| 255 | 255 | $aBody = $xRequest->getParsedBody(); |
| 256 | - if(is_array($aBody)) |
|
| 256 | + if (is_array($aBody)) |
|
| 257 | 257 | { |
| 258 | 258 | return isset($aBody['jxncls']) && isset($aBody['jxnmthd']); |
| 259 | 259 | } |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | public function setTarget(ServerRequestInterface $xRequest) |
| 268 | 268 | { |
| 269 | 269 | $aBody = $xRequest->getParsedBody(); |
| 270 | - if(is_array($aBody)) |
|
| 270 | + if (is_array($aBody)) |
|
| 271 | 271 | { |
| 272 | 272 | $this->xTarget = Target::makeClass(trim($aBody['jxncls']), trim($aBody['jxnmthd'])); |
| 273 | 273 | return; |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | $sMethodName = $this->xTarget->getMethodName(); |
| 287 | 287 | $this->xTarget->setMethodArgs($this->xParameterReader->args()); |
| 288 | 288 | |
| 289 | - if(!$this->xValidator->validateClass($sClassName) || !$this->xValidator->validateMethod($sMethodName)) |
|
| 289 | + if (!$this->xValidator->validateClass($sClassName) || !$this->xValidator->validateMethod($sMethodName)) |
|
| 290 | 290 | { |
| 291 | 291 | // Unable to find the requested object or method |
| 292 | 292 | throw new RequestException($this->xTranslator->trans('errors.objects.invalid', |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | $xCallableObject = $this->xRegistry->getCallableObject($sClassName); |
| 300 | 300 | return $xCallableObject->call($this->xTarget); |
| 301 | 301 | } |
| 302 | - catch(ReflectionException|SetupException $e) |
|
| 302 | + catch (ReflectionException | SetupException $e) |
|
| 303 | 303 | { |
| 304 | 304 | // Unable to find the requested class or method |
| 305 | 305 | $this->di->getLogger()->error($e->getMessage()); |
@@ -331,16 +331,16 @@ |
||
| 331 | 331 | $sPrefix = substr($sName, 0, 15); |
| 332 | 332 | switch($sPrefix) |
| 333 | 333 | { |
| 334 | - case 'dialogs.default': |
|
| 335 | - $this->setDefaultLibraries(); |
|
| 336 | - return; |
|
| 337 | - case 'dialogs.lib.ext': |
|
| 338 | - $this->registerLibraries(); |
|
| 339 | - return; |
|
| 340 | - case 'dialogs.lib.use': |
|
| 341 | - $this->setUsedLibraries(); |
|
| 342 | - return; |
|
| 343 | - default: |
|
| 334 | + case 'dialogs.default': |
|
| 335 | + $this->setDefaultLibraries(); |
|
| 336 | + return; |
|
| 337 | + case 'dialogs.lib.ext': |
|
| 338 | + $this->registerLibraries(); |
|
| 339 | + return; |
|
| 340 | + case 'dialogs.lib.use': |
|
| 341 | + $this->setUsedLibraries(); |
|
| 342 | + return; |
|
| 343 | + default: |
|
| 344 | 344 | } |
| 345 | 345 | } |
| 346 | 346 | } |
@@ -106,11 +106,11 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | public function registerLibrary(string $sClassName, string $sLibraryName) |
| 108 | 108 | { |
| 109 | - if(isset($this->aLibraries[$sLibraryName])) |
|
| 109 | + if (isset($this->aLibraries[$sLibraryName])) |
|
| 110 | 110 | { |
| 111 | 111 | return; |
| 112 | 112 | } |
| 113 | - if(!($aInterfaces = class_implements($sClassName))) |
|
| 113 | + if (!($aInterfaces = class_implements($sClassName))) |
|
| 114 | 114 | { |
| 115 | 115 | // The class is invalid. |
| 116 | 116 | $sMessage = $this->xTranslator->trans('errors.register.invalid', ['name' => $sClassName]); |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | $bIsQuestion = in_array(QuestionInterface::class, $aInterfaces); |
| 121 | 121 | $bIsMessage = in_array(MessageInterface::class, $aInterfaces); |
| 122 | 122 | $bIsModal = in_array(ModalInterface::class, $aInterfaces); |
| 123 | - if(!$bIsQuestion && !$bIsMessage && !$bIsModal) |
|
| 123 | + if (!$bIsQuestion && !$bIsMessage && !$bIsModal) |
|
| 124 | 124 | { |
| 125 | 125 | // The class is invalid. |
| 126 | 126 | $sMessage = $this->xTranslator->trans('errors.register.invalid', ['name' => $sClassName]); |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | */ |
| 149 | 149 | public function setQuestionLibrary(string $sLibraryName) |
| 150 | 150 | { |
| 151 | - if(!isset($this->aLibraries[$sLibraryName]) || !$this->aLibraries[$sLibraryName]['question']) |
|
| 151 | + if (!isset($this->aLibraries[$sLibraryName]) || !$this->aLibraries[$sLibraryName]['question']) |
|
| 152 | 152 | { |
| 153 | 153 | $sMessage = $this->xTranslator->trans('errors.dialog.library', |
| 154 | 154 | ['type' => 'question', 'name' => $sLibraryName]); |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | */ |
| 178 | 178 | public function setMessageLibrary(string $sLibraryName) |
| 179 | 179 | { |
| 180 | - if(!isset($this->aLibraries[$sLibraryName]) || !$this->aLibraries[$sLibraryName]['message']) |
|
| 180 | + if (!isset($this->aLibraries[$sLibraryName]) || !$this->aLibraries[$sLibraryName]['message']) |
|
| 181 | 181 | { |
| 182 | 182 | $sMessage = $this->xTranslator->trans('errors.dialog.library', |
| 183 | 183 | ['type' => 'message', 'name' => $sLibraryName]); |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | */ |
| 207 | 207 | public function setModalLibrary(string $sLibraryName) |
| 208 | 208 | { |
| 209 | - if(!isset($this->aLibraries[$sLibraryName]) || !$this->aLibraries[$sLibraryName]['modal']) |
|
| 209 | + if (!isset($this->aLibraries[$sLibraryName]) || !$this->aLibraries[$sLibraryName]['modal']) |
|
| 210 | 210 | { |
| 211 | 211 | $sMessage = $this->xTranslator->trans('errors.dialog.library', |
| 212 | 212 | ['type' => 'modal', 'name' => $sLibraryName]); |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | protected function registerLibraries() |
| 247 | 247 | { |
| 248 | 248 | $aLibraries = $this->xConfigManager->getOption('dialogs.lib.ext', []); |
| 249 | - foreach($aLibraries as $sLibraryName => $sClassName) |
|
| 249 | + foreach ($aLibraries as $sLibraryName => $sClassName) |
|
| 250 | 250 | { |
| 251 | 251 | $this->registerLibrary($sClassName, $sLibraryName); |
| 252 | 252 | } |
@@ -261,19 +261,19 @@ discard block |
||
| 261 | 261 | protected function setDefaultLibraries() |
| 262 | 262 | { |
| 263 | 263 | // Set the default modal library |
| 264 | - if(($sLibraryName = $this->xConfigManager->getOption('dialogs.default.modal', ''))) |
|
| 264 | + if (($sLibraryName = $this->xConfigManager->getOption('dialogs.default.modal', ''))) |
|
| 265 | 265 | { |
| 266 | 266 | $this->setModalLibrary($sLibraryName); |
| 267 | 267 | $this->aLibraries[$sLibraryName]['used'] = true; |
| 268 | 268 | } |
| 269 | 269 | // Set the default message library |
| 270 | - if(($sLibraryName = $this->xConfigManager->getOption('dialogs.default.message', ''))) |
|
| 270 | + if (($sLibraryName = $this->xConfigManager->getOption('dialogs.default.message', ''))) |
|
| 271 | 271 | { |
| 272 | 272 | $this->setMessageLibrary($sLibraryName); |
| 273 | 273 | $this->aLibraries[$sLibraryName]['used'] = true; |
| 274 | 274 | } |
| 275 | 275 | // Set the default question library |
| 276 | - if(($sLibraryName = $this->xConfigManager->getOption('dialogs.default.question', ''))) |
|
| 276 | + if (($sLibraryName = $this->xConfigManager->getOption('dialogs.default.question', ''))) |
|
| 277 | 277 | { |
| 278 | 278 | $this->setQuestionLibrary($sLibraryName); |
| 279 | 279 | $this->aLibraries[$sLibraryName]['used'] = true; |
@@ -289,9 +289,9 @@ discard block |
||
| 289 | 289 | { |
| 290 | 290 | // Set the other libraries in use |
| 291 | 291 | $aLibraries = $this->xConfigManager->getOption('dialogs.lib.use', []); |
| 292 | - foreach($aLibraries as $sLibraryName) |
|
| 292 | + foreach ($aLibraries as $sLibraryName) |
|
| 293 | 293 | { |
| 294 | - if(isset($this->aLibraries[$sLibraryName])) // Make sure the library exists |
|
| 294 | + if (isset($this->aLibraries[$sLibraryName])) // Make sure the library exists |
|
| 295 | 295 | { |
| 296 | 296 | $this->aLibraries[$sLibraryName]['used'] = true; |
| 297 | 297 | } |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | */ |
| 321 | 321 | public function onChange(Config $xConfig, string $sName) |
| 322 | 322 | { |
| 323 | - if($sName === '') |
|
| 323 | + if ($sName === '') |
|
| 324 | 324 | { |
| 325 | 325 | // Reset the default libraries any time the config is changed. |
| 326 | 326 | $this->registerLibraries(); |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | return; |
| 330 | 330 | } |
| 331 | 331 | $sPrefix = substr($sName, 0, 15); |
| 332 | - switch($sPrefix) |
|
| 332 | + switch ($sPrefix) |
|
| 333 | 333 | { |
| 334 | 334 | case 'dialogs.default': |
| 335 | 335 | $this->setDefaultLibraries(); |
@@ -291,10 +291,12 @@ |
||
| 291 | 291 | $aLibraries = $this->xConfigManager->getOption('dialogs.lib.use', []); |
| 292 | 292 | foreach($aLibraries as $sLibraryName) |
| 293 | 293 | { |
| 294 | - if(isset($this->aLibraries[$sLibraryName])) // Make sure the library exists |
|
| 294 | + if(isset($this->aLibraries[$sLibraryName])) { |
|
| 295 | + // Make sure the library exists |
|
| 295 | 296 | { |
| 296 | 297 | $this->aLibraries[$sLibraryName]['used'] = true; |
| 297 | 298 | } |
| 299 | + } |
|
| 298 | 300 | } |
| 299 | 301 | } |
| 300 | 302 | |
@@ -53,7 +53,7 @@ |
||
| 53 | 53 | { |
| 54 | 54 | $this->sDirectory = ''; |
| 55 | 55 | $this->sExtension = ''; |
| 56 | - if(isset($this->aDirectories[$sNamespace])) |
|
| 56 | + if (isset($this->aDirectories[$sNamespace])) |
|
| 57 | 57 | { |
| 58 | 58 | // Make sure there's only one '/' at the end of the string |
| 59 | 59 | $this->sDirectory = rtrim($this->aDirectories[$sNamespace]['path'], '/') . '/'; |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | */ |
| 116 | 116 | public function addCodeGenerator(string $sClassName, int $nPriority) |
| 117 | 117 | { |
| 118 | - while(isset($this->aCodeGenerators[$nPriority])) |
|
| 118 | + while (isset($this->aCodeGenerators[$nPriority])) |
|
| 119 | 119 | { |
| 120 | 120 | $nPriority++; |
| 121 | 121 | } |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | private function generatePluginCodes(string $sClassName) |
| 159 | 159 | { |
| 160 | 160 | $xGenerator = $this->di->g($sClassName); |
| 161 | - if(!is_subclass_of($xGenerator, Plugin::class) || $this->xAssetManager->shallIncludeAssets($xGenerator)) |
|
| 161 | + if (!is_subclass_of($xGenerator, Plugin::class) || $this->xAssetManager->shallIncludeAssets($xGenerator)) |
|
| 162 | 162 | { |
| 163 | 163 | // HTML tags for CSS |
| 164 | 164 | $this->sCss = trim($this->sCss) . "\n" . trim($xGenerator->getCss(), " \n"); |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | } |
| 168 | 168 | // Javascript code |
| 169 | 169 | $this->sJsScript = trim($this->sJsScript) . "\n\n" . trim($xGenerator->getScript(), " \n"); |
| 170 | - if($xGenerator->readyEnabled()) |
|
| 170 | + if ($xGenerator->readyEnabled()) |
|
| 171 | 171 | { |
| 172 | 172 | $sScriptAttr = $xGenerator->readyInlined() ? 'sJsInlineScript' : 'sJsReadyScript'; |
| 173 | 173 | $this->$sScriptAttr = trim($this->$sScriptAttr) . "\n\n" . trim($xGenerator->getReadyScript(), " \n"); |
@@ -186,11 +186,11 @@ discard block |
||
| 186 | 186 | $this->sJsScript = trim($this->sJsScript, " \n"); |
| 187 | 187 | $this->sJsReadyScript = trim($this->sJsReadyScript, " \n"); |
| 188 | 188 | $this->sJsInlineScript = trim($this->sJsInlineScript, " \n"); |
| 189 | - if(($this->sJsReadyScript)) |
|
| 189 | + if (($this->sJsReadyScript)) |
|
| 190 | 190 | { |
| 191 | 191 | $this->sJsReadyScript = $this->render('ready.js', ['sScript' => $this->sJsReadyScript . "\n"]); |
| 192 | 192 | } |
| 193 | - if(($this->sJsInlineScript)) |
|
| 193 | + if (($this->sJsInlineScript)) |
|
| 194 | 194 | { |
| 195 | 195 | $this->sJsInlineScript = $this->render('ready.js', ['sScript' => $this->sJsInlineScript . "\n"]); |
| 196 | 196 | } |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | */ |
| 208 | 208 | private function generateCodes() |
| 209 | 209 | { |
| 210 | - if($this->bGenerated) |
|
| 210 | + if ($this->bGenerated) |
|
| 211 | 211 | { |
| 212 | 212 | return; |
| 213 | 213 | } |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | |
| 218 | 218 | $this->xAssetManager = $this->di->getAssetManager(); |
| 219 | 219 | $this->sJsOptions = $this->xAssetManager->getJsOptions(); |
| 220 | - foreach($this->aCodeGenerators as $sClassName) |
|
| 220 | + foreach ($this->aCodeGenerators as $sClassName) |
|
| 221 | 221 | { |
| 222 | 222 | $this->generatePluginCodes($sClassName); |
| 223 | 223 | } |
@@ -279,16 +279,16 @@ discard block |
||
| 279 | 279 | { |
| 280 | 280 | $this->generateCodes(); |
| 281 | 281 | $sScript = ''; |
| 282 | - if(($bIncludeCss)) |
|
| 282 | + if (($bIncludeCss)) |
|
| 283 | 283 | { |
| 284 | 284 | $sScript .= $this->getCss() . "\n"; |
| 285 | 285 | } |
| 286 | - if(($bIncludeJs)) |
|
| 286 | + if (($bIncludeJs)) |
|
| 287 | 287 | { |
| 288 | 288 | $sScript .= $this->getJs() . "\n"; |
| 289 | 289 | } |
| 290 | 290 | |
| 291 | - if(!($sUrl = $this->xAssetManager->createJsFiles($this))) |
|
| 291 | + if (!($sUrl = $this->xAssetManager->createJsFiles($this))) |
|
| 292 | 292 | { |
| 293 | 293 | return trim($sScript) . "\n\n" . $this->render('wrapper.js', |
| 294 | 294 | ['sScript' => trim($this->sJsScript) . "\n\n" . trim($this->sJsInlineScript)]); |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | public function clear() |
| 81 | 81 | { |
| 82 | - if($this->xResponse !== null) |
|
| 82 | + if ($this->xResponse !== null) |
|
| 83 | 83 | { |
| 84 | 84 | $this->xResponse->clearCommands(); |
| 85 | 85 | } |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | */ |
| 94 | 94 | public function getResponse(): ResponseInterface |
| 95 | 95 | { |
| 96 | - if(!$this->xResponse) |
|
| 96 | + if (!$this->xResponse) |
|
| 97 | 97 | { |
| 98 | 98 | $this->xResponse = $this->di->getResponse(); |
| 99 | 99 | } |
@@ -114,21 +114,21 @@ discard block |
||
| 114 | 114 | */ |
| 115 | 115 | public function append(ResponseInterface $xResponse) |
| 116 | 116 | { |
| 117 | - if(!$this->xResponse) |
|
| 117 | + if (!$this->xResponse) |
|
| 118 | 118 | { |
| 119 | 119 | $this->xResponse = $this->di->getResponse(); |
| 120 | 120 | } |
| 121 | - if($this->xResponse->getCommandCount() === 0) |
|
| 121 | + if ($this->xResponse->getCommandCount() === 0) |
|
| 122 | 122 | { |
| 123 | 123 | $this->xResponse = $xResponse; |
| 124 | 124 | return; |
| 125 | 125 | } |
| 126 | - if(get_class($this->xResponse) !== get_class($xResponse)) |
|
| 126 | + if (get_class($this->xResponse) !== get_class($xResponse)) |
|
| 127 | 127 | { |
| 128 | 128 | throw new RequestException($this->xTranslator->trans('errors.mismatch.types', |
| 129 | 129 | ['class' => get_class($xResponse)])); |
| 130 | 130 | } |
| 131 | - if($this->xResponse !== $xResponse) |
|
| 131 | + if ($this->xResponse !== $xResponse) |
|
| 132 | 132 | { |
| 133 | 133 | $this->xResponse->appendResponse($xResponse); |
| 134 | 134 | } |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | */ |
| 170 | 170 | public function printDebug() |
| 171 | 171 | { |
| 172 | - foreach($this->aDebugMessages as $sMessage) |
|
| 172 | + foreach ($this->aDebugMessages as $sMessage) |
|
| 173 | 173 | { |
| 174 | 174 | $this->getResponse()->debug($sMessage); |
| 175 | 175 | } |
@@ -183,8 +183,7 @@ discard block |
||
| 183 | 183 | */ |
| 184 | 184 | public function getContentType(): string |
| 185 | 185 | { |
| 186 | - return empty($this->sCharacterEncoding) ? $this->getResponse()->getContentType() : |
|
| 187 | - $this->getResponse()->getContentType() . '; charset="' . $this->sCharacterEncoding . '"'; |
|
| 186 | + return empty($this->sCharacterEncoding) ? $this->getResponse()->getContentType() : $this->getResponse()->getContentType() . '; charset="' . $this->sCharacterEncoding . '"'; |
|
| 188 | 187 | } |
| 189 | 188 | |
| 190 | 189 | /** |