@@ -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'], '/') . '/'; |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | */ |
| 145 | 145 | public function has(string $sClass): bool |
| 146 | 146 | { |
| 147 | - if($this->xContainer != null && $this->xContainer->has($sClass)) |
|
| 147 | + if ($this->xContainer != null && $this->xContainer->has($sClass)) |
|
| 148 | 148 | { |
| 149 | 149 | return true; |
| 150 | 150 | } |
@@ -175,13 +175,13 @@ discard block |
||
| 175 | 175 | { |
| 176 | 176 | try |
| 177 | 177 | { |
| 178 | - if($this->xContainer != null && $this->xContainer->has($sClass)) |
|
| 178 | + if ($this->xContainer != null && $this->xContainer->has($sClass)) |
|
| 179 | 179 | { |
| 180 | 180 | return $this->xContainer->get($sClass); |
| 181 | 181 | } |
| 182 | 182 | return $this->offsetGet($sClass); |
| 183 | 183 | } |
| 184 | - catch(Exception|Throwable $e) |
|
| 184 | + catch (Exception | Throwable $e) |
|
| 185 | 185 | { |
| 186 | 186 | $xLogger = $this->g(LoggerInterface::class); |
| 187 | 187 | $xTranslator = $this->g(Translator::class); |
@@ -243,15 +243,15 @@ discard block |
||
| 243 | 243 | { |
| 244 | 244 | $xType = $xParameter->getType(); |
| 245 | 245 | // Check the parameter class first. |
| 246 | - if($xType instanceof ReflectionNamedType) |
|
| 246 | + if ($xType instanceof ReflectionNamedType) |
|
| 247 | 247 | { |
| 248 | 248 | // Check the class + the name |
| 249 | - if($this->has($xType->getName() . ' $' . $xParameter->getName())) |
|
| 249 | + if ($this->has($xType->getName() . ' $' . $xParameter->getName())) |
|
| 250 | 250 | { |
| 251 | 251 | return $this->get($xType->getName() . ' $' . $xParameter->getName()); |
| 252 | 252 | } |
| 253 | 253 | // Check the class only |
| 254 | - if($this->get($xType->getName())) |
|
| 254 | + if ($this->get($xType->getName())) |
|
| 255 | 255 | { |
| 256 | 256 | return $this->get($xType->getName()); |
| 257 | 257 | } |
@@ -271,16 +271,16 @@ discard block |
||
| 271 | 271 | */ |
| 272 | 272 | public function make($xClass) |
| 273 | 273 | { |
| 274 | - if(is_string($xClass)) |
|
| 274 | + if (is_string($xClass)) |
|
| 275 | 275 | { |
| 276 | 276 | $xClass = new ReflectionClass($xClass); // Create the reflection class instance |
| 277 | 277 | } |
| 278 | - if(!($xClass instanceof ReflectionClass)) |
|
| 278 | + if (!($xClass instanceof ReflectionClass)) |
|
| 279 | 279 | { |
| 280 | 280 | return null; |
| 281 | 281 | } |
| 282 | 282 | // Use the Reflection class to get the parameters of the constructor |
| 283 | - if(($constructor = $xClass->getConstructor()) === null) |
|
| 283 | + if (($constructor = $xClass->getConstructor()) === null) |
|
| 284 | 284 | { |
| 285 | 285 | return $xClass->newInstance(); |
| 286 | 286 | } |
@@ -180,8 +180,7 @@ |
||
| 180 | 180 | return $this->xContainer->get($sClass); |
| 181 | 181 | } |
| 182 | 182 | return $this->offsetGet($sClass); |
| 183 | - } |
|
| 184 | - catch(Exception|Throwable $e) |
|
| 183 | + } catch(Exception|Throwable $e) |
|
| 185 | 184 | { |
| 186 | 185 | $xLogger = $this->g(LoggerInterface::class); |
| 187 | 186 | $xTranslator = $this->g(Translator::class); |
@@ -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)]); |
@@ -123,28 +123,28 @@ discard block |
||
| 123 | 123 | { |
| 124 | 124 | $bIsUsed = false; |
| 125 | 125 | $aInterfaces = class_implements($sClassName); |
| 126 | - if(in_array(CodeGeneratorInterface::class, $aInterfaces)) |
|
| 126 | + if (in_array(CodeGeneratorInterface::class, $aInterfaces)) |
|
| 127 | 127 | { |
| 128 | 128 | $this->xCodeGenerator->addCodeGenerator($sClassName, $nPriority); |
| 129 | 129 | $bIsUsed = true; |
| 130 | 130 | } |
| 131 | - if(in_array(CallableRegistryInterface::class, $aInterfaces)) |
|
| 131 | + if (in_array(CallableRegistryInterface::class, $aInterfaces)) |
|
| 132 | 132 | { |
| 133 | 133 | $this->aRegistryPlugins[$sPluginName] = $sClassName; |
| 134 | 134 | $bIsUsed = true; |
| 135 | 135 | } |
| 136 | - if(in_array(RequestHandlerInterface::class, $aInterfaces)) |
|
| 136 | + if (in_array(RequestHandlerInterface::class, $aInterfaces)) |
|
| 137 | 137 | { |
| 138 | 138 | $this->aRequestHandlers[$sPluginName] = $sClassName; |
| 139 | 139 | $bIsUsed = true; |
| 140 | 140 | } |
| 141 | - if(in_array(ResponsePluginInterface::class, $aInterfaces)) |
|
| 141 | + if (in_array(ResponsePluginInterface::class, $aInterfaces)) |
|
| 142 | 142 | { |
| 143 | 143 | $this->aResponsePlugins[$sPluginName] = $sClassName; |
| 144 | 144 | $bIsUsed = true; |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | - if(!$bIsUsed) |
|
| 147 | + if (!$bIsUsed) |
|
| 148 | 148 | { |
| 149 | 149 | // The class is invalid. |
| 150 | 150 | $sMessage = $this->xTranslator->trans('errors.register.invalid', ['name' => $sClassName]); |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | // Register the plugin in the DI container, if necessary |
| 155 | - if(!$this->di->has($sClassName)) |
|
| 155 | + if (!$this->di->has($sClassName)) |
|
| 156 | 156 | { |
| 157 | 157 | $this->di->auto($sClassName); |
| 158 | 158 | } |
@@ -168,12 +168,12 @@ discard block |
||
| 168 | 168 | */ |
| 169 | 169 | public function getResponsePlugin(string $sName, ?Response $xResponse = null): ?ResponsePlugin |
| 170 | 170 | { |
| 171 | - if(!isset($this->aResponsePlugins[$sName])) |
|
| 171 | + if (!isset($this->aResponsePlugins[$sName])) |
|
| 172 | 172 | { |
| 173 | 173 | return null; |
| 174 | 174 | } |
| 175 | 175 | $xPlugin = $this->di->g($this->aResponsePlugins[$sName]); |
| 176 | - if(($xResponse)) |
|
| 176 | + if (($xResponse)) |
|
| 177 | 177 | { |
| 178 | 178 | $xPlugin->setResponse($xResponse); |
| 179 | 179 | } |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | */ |
| 195 | 195 | public function registerCallable(string $sType, string $sCallable, $xOptions = []) |
| 196 | 196 | { |
| 197 | - if(isset($this->aRegistryPlugins[$sType]) && |
|
| 197 | + if (isset($this->aRegistryPlugins[$sType]) && |
|
| 198 | 198 | ($xPlugin = $this->di->g($this->aRegistryPlugins[$sType]))) |
| 199 | 199 | { |
| 200 | 200 | $xPlugin->register($sType, $sCallable, $xPlugin->checkOptions($sCallable, $xOptions)); |
@@ -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 | } |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | */ |
| 146 | 146 | public function bag(string $sName): DataBagContext |
| 147 | 147 | { |
| 148 | - return $this->plugin('bags')->bag($sName);; |
|
| 148 | + return $this->plugin('bags')->bag($sName); ; |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | /** |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | public function addCommand(array $aAttributes, $mData): Response |
| 160 | 160 | { |
| 161 | 161 | $aAttributes = array_map(function($xAttribute) { |
| 162 | - return is_integer($xAttribute) ? $xAttribute : trim((string)$xAttribute, " \t"); |
|
| 162 | + return is_integer($xAttribute) ? $xAttribute : trim((string) $xAttribute, " \t"); |
|
| 163 | 163 | }, $aAttributes); |
| 164 | 164 | $aAttributes['data'] = $mData; |
| 165 | 165 | $this->aCommands[] = $aAttributes; |
@@ -179,9 +179,9 @@ discard block |
||
| 179 | 179 | protected function _addCommand(string $sName, array $aAttributes, $mData, bool $bRemoveEmpty = false): Response |
| 180 | 180 | { |
| 181 | 181 | $mData = is_array($mData) ? array_map(function($sData) { |
| 182 | - return trim((string)$sData, " \t\n"); |
|
| 183 | - }, $mData) : trim((string)$mData, " \t\n"); |
|
| 184 | - if($bRemoveEmpty) |
|
| 182 | + return trim((string) $sData, " \t\n"); |
|
| 183 | + }, $mData) : trim((string) $mData, " \t\n"); |
|
| 184 | + if ($bRemoveEmpty) |
|
| 185 | 185 | { |
| 186 | 186 | $aAttributes = array_filter($aAttributes, function($xValue) { |
| 187 | 187 | return $xValue === ''; |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | public function toPsr(): PsrResponseInterface |
| 215 | 215 | { |
| 216 | 216 | $xPsrResponse = $this->xPsr17Factory->createResponse(200); |
| 217 | - if($this->xRequest->getMethod() === 'GET') |
|
| 217 | + if ($this->xRequest->getMethod() === 'GET') |
|
| 218 | 218 | { |
| 219 | 219 | $xPsrResponse = $xPsrResponse |
| 220 | 220 | ->withHeader('Expires', 'Mon, 26 Jul 1997 05:00:00 GMT') |
@@ -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 | /** |
@@ -94,7 +94,7 @@ |
||
| 94 | 94 | public function redirect(string $sURL, int $nDelay = 0): Response |
| 95 | 95 | { |
| 96 | 96 | $sURL = $this->xPluginManager->getParameterReader()->parseUrl($sURL); |
| 97 | - if($nDelay <= 0) |
|
| 97 | + if ($nDelay <= 0) |
|
| 98 | 98 | { |
| 99 | 99 | return $this->script("window.location = '$sURL';"); |
| 100 | 100 | } |
@@ -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'; |