@@ -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 | } |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | trim($this->sJsScript) . "\n\n" . trim($this->sJsReadyScript); |
| 230 | 230 | // For js lib versions prior to 4.0, register the redirect command. |
| 231 | 231 | $sJsLibVersion = $this->di->getJsLibVersion(); |
| 232 | - if((int)$sJsLibVersion[0] < 4) |
|
| 232 | + if ((int) $sJsLibVersion[0] < 4) |
|
| 233 | 233 | { |
| 234 | 234 | $this->sJsScript .= ' |
| 235 | 235 | |
@@ -296,16 +296,16 @@ discard block |
||
| 296 | 296 | { |
| 297 | 297 | $this->generateCodes(); |
| 298 | 298 | $sScript = ''; |
| 299 | - if(($bIncludeCss)) |
|
| 299 | + if (($bIncludeCss)) |
|
| 300 | 300 | { |
| 301 | 301 | $sScript .= $this->getCss() . "\n"; |
| 302 | 302 | } |
| 303 | - if(($bIncludeJs)) |
|
| 303 | + if (($bIncludeJs)) |
|
| 304 | 304 | { |
| 305 | 305 | $sScript .= $this->getJs() . "\n"; |
| 306 | 306 | } |
| 307 | 307 | |
| 308 | - if(!($sUrl = $this->xAssetManager->createJsFiles($this))) |
|
| 308 | + if (!($sUrl = $this->xAssetManager->createJsFiles($this))) |
|
| 309 | 309 | { |
| 310 | 310 | return trim($sScript) . "\n\n" . $this->render('wrapper.js', |
| 311 | 311 | ['sScript' => trim($this->sJsScript) . "\n\n" . trim($this->sJsInlineScript)]); |
@@ -124,28 +124,28 @@ discard block |
||
| 124 | 124 | { |
| 125 | 125 | $bIsUsed = false; |
| 126 | 126 | $aInterfaces = class_implements($sClassName); |
| 127 | - if(in_array(CodeGeneratorInterface::class, $aInterfaces)) |
|
| 127 | + if (in_array(CodeGeneratorInterface::class, $aInterfaces)) |
|
| 128 | 128 | { |
| 129 | 129 | $this->xCodeGenerator->addCodeGenerator($sClassName, $nPriority); |
| 130 | 130 | $bIsUsed = true; |
| 131 | 131 | } |
| 132 | - if(in_array(CallableRegistryInterface::class, $aInterfaces)) |
|
| 132 | + if (in_array(CallableRegistryInterface::class, $aInterfaces)) |
|
| 133 | 133 | { |
| 134 | 134 | $this->aRegistryPlugins[$sPluginName] = $sClassName; |
| 135 | 135 | $bIsUsed = true; |
| 136 | 136 | } |
| 137 | - if(in_array(RequestHandlerInterface::class, $aInterfaces)) |
|
| 137 | + if (in_array(RequestHandlerInterface::class, $aInterfaces)) |
|
| 138 | 138 | { |
| 139 | 139 | $this->aRequestHandlers[$sPluginName] = $sClassName; |
| 140 | 140 | $bIsUsed = true; |
| 141 | 141 | } |
| 142 | - if(in_array(ResponsePluginInterface::class, $aInterfaces)) |
|
| 142 | + if (in_array(ResponsePluginInterface::class, $aInterfaces)) |
|
| 143 | 143 | { |
| 144 | 144 | $this->aResponsePlugins[$sPluginName] = $sClassName; |
| 145 | 145 | $bIsUsed = true; |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - if(!$bIsUsed) |
|
| 148 | + if (!$bIsUsed) |
|
| 149 | 149 | { |
| 150 | 150 | // The class is invalid. |
| 151 | 151 | $sMessage = $this->xTranslator->trans('errors.register.invalid', ['name' => $sClassName]); |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | // Register the plugin in the DI container, if necessary |
| 156 | - if(!$this->di->has($sClassName)) |
|
| 156 | + if (!$this->di->has($sClassName)) |
|
| 157 | 157 | { |
| 158 | 158 | $this->di->auto($sClassName); |
| 159 | 159 | } |
@@ -169,12 +169,12 @@ discard block |
||
| 169 | 169 | */ |
| 170 | 170 | public function getResponsePlugin(string $sName, ?ResponseInterface $xResponse = null): ?ResponsePlugin |
| 171 | 171 | { |
| 172 | - if(!isset($this->aResponsePlugins[$sName])) |
|
| 172 | + if (!isset($this->aResponsePlugins[$sName])) |
|
| 173 | 173 | { |
| 174 | 174 | return null; |
| 175 | 175 | } |
| 176 | 176 | $xPlugin = $this->di->g($this->aResponsePlugins[$sName]); |
| 177 | - if(($xResponse)) |
|
| 177 | + if (($xResponse)) |
|
| 178 | 178 | { |
| 179 | 179 | $xPlugin->setResponse($xResponse); |
| 180 | 180 | } |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | */ |
| 196 | 196 | public function registerCallable(string $sType, string $sCallable, $xOptions = []) |
| 197 | 197 | { |
| 198 | - if(isset($this->aRegistryPlugins[$sType]) && |
|
| 198 | + if (isset($this->aRegistryPlugins[$sType]) && |
|
| 199 | 199 | ($xPlugin = $this->di->g($this->aRegistryPlugins[$sType]))) |
| 200 | 200 | { |
| 201 | 201 | $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 | } |
@@ -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') |