@@ -207,36 +207,36 @@ |
||
207 | 207 | switch($sName) |
208 | 208 | { |
209 | 209 | // Set the separator |
210 | - case 'separator': |
|
211 | - if($xValue === '_' || $xValue === '.') |
|
212 | - { |
|
213 | - $this->sSeparator = $xValue; |
|
214 | - } |
|
215 | - break; |
|
216 | - // Set the protected methods |
|
217 | - case 'protected': |
|
218 | - if(is_array($xValue)) |
|
219 | - { |
|
220 | - $this->aProtectedMethods = array_merge($this->aProtectedMethods, $xValue); |
|
221 | - } |
|
222 | - break; |
|
223 | - // Set the methods to call before processing the request |
|
224 | - case '__before': |
|
225 | - $this->setHookMethods($this->aBeforeMethods, $xValue); |
|
226 | - break; |
|
227 | - // Set the methods to call after processing the request |
|
228 | - case '__after': |
|
229 | - $this->setHookMethods($this->aAfterMethods, $xValue); |
|
230 | - break; |
|
231 | - // Set the attributes to inject in the callable object |
|
232 | - case '__di': |
|
233 | - $this->aAttributes = array_merge($this->aAttributes, $xValue); |
|
234 | - break; |
|
235 | - case 'excluded': |
|
236 | - $this->bExcluded = (bool)$xValue; |
|
237 | - break; |
|
238 | - default: |
|
239 | - break; |
|
210 | + case 'separator': |
|
211 | + if($xValue === '_' || $xValue === '.') |
|
212 | + { |
|
213 | + $this->sSeparator = $xValue; |
|
214 | + } |
|
215 | + break; |
|
216 | + // Set the protected methods |
|
217 | + case 'protected': |
|
218 | + if(is_array($xValue)) |
|
219 | + { |
|
220 | + $this->aProtectedMethods = array_merge($this->aProtectedMethods, $xValue); |
|
221 | + } |
|
222 | + break; |
|
223 | + // Set the methods to call before processing the request |
|
224 | + case '__before': |
|
225 | + $this->setHookMethods($this->aBeforeMethods, $xValue); |
|
226 | + break; |
|
227 | + // Set the methods to call after processing the request |
|
228 | + case '__after': |
|
229 | + $this->setHookMethods($this->aAfterMethods, $xValue); |
|
230 | + break; |
|
231 | + // Set the attributes to inject in the callable object |
|
232 | + case '__di': |
|
233 | + $this->aAttributes = array_merge($this->aAttributes, $xValue); |
|
234 | + break; |
|
235 | + case 'excluded': |
|
236 | + $this->bExcluded = (bool)$xValue; |
|
237 | + break; |
|
238 | + default: |
|
239 | + break; |
|
240 | 240 | } |
241 | 241 | } |
242 | 242 |
@@ -186,8 +186,7 @@ |
||
186 | 186 | if(is_array($xMethodToCall)) |
187 | 187 | { |
188 | 188 | $aHookMethods[$sCalledMethod] = $xMethodToCall; |
189 | - } |
|
190 | - elseif(is_string($xMethodToCall)) |
|
189 | + } elseif(is_string($xMethodToCall)) |
|
191 | 190 | { |
192 | 191 | $aHookMethods[$sCalledMethod] = [$xMethodToCall]; |
193 | 192 | } |
@@ -182,13 +182,13 @@ discard block |
||
182 | 182 | */ |
183 | 183 | private function setHookMethods(array &$aHookMethods, $xValue) |
184 | 184 | { |
185 | - foreach($xValue as $sCalledMethod => $xMethodToCall) |
|
185 | + foreach ($xValue as $sCalledMethod => $xMethodToCall) |
|
186 | 186 | { |
187 | - if(is_array($xMethodToCall)) |
|
187 | + if (is_array($xMethodToCall)) |
|
188 | 188 | { |
189 | 189 | $aHookMethods[$sCalledMethod] = $xMethodToCall; |
190 | 190 | } |
191 | - elseif(is_string($xMethodToCall)) |
|
191 | + elseif (is_string($xMethodToCall)) |
|
192 | 192 | { |
193 | 193 | $aHookMethods[$sCalledMethod] = [$xMethodToCall]; |
194 | 194 | } |
@@ -205,18 +205,18 @@ discard block |
||
205 | 205 | */ |
206 | 206 | public function configure(string $sName, $xValue) |
207 | 207 | { |
208 | - switch($sName) |
|
208 | + switch ($sName) |
|
209 | 209 | { |
210 | 210 | // Set the separator |
211 | 211 | case 'separator': |
212 | - if($xValue === '_' || $xValue === '.') |
|
212 | + if ($xValue === '_' || $xValue === '.') |
|
213 | 213 | { |
214 | 214 | $this->sSeparator = $xValue; |
215 | 215 | } |
216 | 216 | break; |
217 | 217 | // Set the protected methods |
218 | 218 | case 'protected': |
219 | - if(is_array($xValue)) |
|
219 | + if (is_array($xValue)) |
|
220 | 220 | { |
221 | 221 | $this->aProtectedMethods = array_merge($this->aProtectedMethods, $xValue); |
222 | 222 | } |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | $this->aAttributes = array_merge($this->aAttributes, $xValue); |
235 | 235 | break; |
236 | 236 | case 'excluded': |
237 | - $this->bExcluded = (bool)$xValue; |
|
237 | + $this->bExcluded = (bool) $xValue; |
|
238 | 238 | break; |
239 | 239 | default: |
240 | 240 | break; |
@@ -340,11 +340,11 @@ discard block |
||
340 | 340 | private function callHookMethods(array $aHookMethods, string $sMethod) |
341 | 341 | { |
342 | 342 | $aMethods = $aHookMethods[$sMethod] ?? $aHookMethods['*'] ?? []; |
343 | - foreach($aMethods as $xKey => $xValue) |
|
343 | + foreach ($aMethods as $xKey => $xValue) |
|
344 | 344 | { |
345 | 345 | $sMethodName = $xValue; |
346 | 346 | $aMethodArgs = []; |
347 | - if(is_string($xKey)) |
|
347 | + if (is_string($xKey)) |
|
348 | 348 | { |
349 | 349 | $sMethodName = $xKey; |
350 | 350 | $aMethodArgs = is_array($xValue) ? $xValue : [$xValue]; |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | |
370 | 370 | // Set attributes from the DI container |
371 | 371 | $aAttributes = $this->aAttributes[$sMethod] ?? $this->aAttributes['*'] ?? []; |
372 | - foreach($aAttributes as $sName => $sClass) |
|
372 | + foreach ($aAttributes as $sName => $sClass) |
|
373 | 373 | { |
374 | 374 | // Set the protected attributes of the object |
375 | 375 | $cSetter = function($c) use($sClass, $sName) { |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function setDataBag() |
41 | 41 | { |
42 | - if($this->xDataBag !== null) |
|
42 | + if ($this->xDataBag !== null) |
|
43 | 43 | { |
44 | 44 | return; |
45 | 45 | } |
@@ -48,8 +48,7 @@ discard block |
||
48 | 48 | $aBody = $xRequest->getParsedBody(); |
49 | 49 | $aParams = $xRequest->getQueryParams(); |
50 | 50 | $aData = is_array($aBody) ? |
51 | - $this->readData($aBody['jxnbags'] ?? []) : |
|
52 | - $this->readData($aParams['jxnbags'] ?? []); |
|
51 | + $this->readData($aBody['jxnbags'] ?? []) : $this->readData($aParams['jxnbags'] ?? []); |
|
53 | 52 | $this->xDataBag = new DataBag($aData); |
54 | 53 | } |
55 | 54 | |
@@ -69,7 +68,7 @@ discard block |
||
69 | 68 | private function readData($xData): array |
70 | 69 | { |
71 | 70 | // Todo: clean input data. |
72 | - if(is_string($xData)) |
|
71 | + if (is_string($xData)) |
|
73 | 72 | { |
74 | 73 | return json_decode($xData, true) ?: []; |
75 | 74 | } |
@@ -105,7 +104,7 @@ discard block |
||
105 | 104 | public function writeCommand() |
106 | 105 | { |
107 | 106 | $this->setDataBag(); |
108 | - if($this->xDataBag->touched()) |
|
107 | + if ($this->xDataBag->touched()) |
|
109 | 108 | { |
110 | 109 | $this->addCommand(['cmd' => 'bags.set'], $this->xDataBag->getAll()); |
111 | 110 | } |
@@ -126,7 +126,7 @@ |
||
126 | 126 | */ |
127 | 127 | private function getLibraries(): array |
128 | 128 | { |
129 | - if($this->aLibraries === null) |
|
129 | + if ($this->aLibraries === null) |
|
130 | 130 | { |
131 | 131 | $this->aLibraries = $this->xLibraryManager->getLibraries(); |
132 | 132 | } |
@@ -60,11 +60,11 @@ discard block |
||
60 | 60 | $sContext = trim($sContext, " \t"); |
61 | 61 | $this->aCalls = []; |
62 | 62 | |
63 | - if(!$sPath) |
|
63 | + if (!$sPath) |
|
64 | 64 | { |
65 | 65 | $this->sPath = "$jQueryNs(this)"; // If an empty selector is given, use javascript "this" instead |
66 | 66 | } |
67 | - elseif(($sContext)) |
|
67 | + elseif (($sContext)) |
|
68 | 68 | { |
69 | 69 | $this->sPath = "$jQueryNs('" . $sPath . "', $jQueryNs('" . $sContext . "'))"; |
70 | 70 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | */ |
129 | 129 | public function getScript(): string |
130 | 130 | { |
131 | - if(count($this->aCalls) === 0) |
|
131 | + if (count($this->aCalls) === 0) |
|
132 | 132 | { |
133 | 133 | return $this->sPath; |
134 | 134 | } |
@@ -63,12 +63,10 @@ |
||
63 | 63 | if(!$sPath) |
64 | 64 | { |
65 | 65 | $this->sPath = "$jQueryNs(this)"; // If an empty selector is given, use javascript "this" instead |
66 | - } |
|
67 | - elseif(($sContext)) |
|
66 | + } elseif(($sContext)) |
|
68 | 67 | { |
69 | 68 | $this->sPath = "$jQueryNs('" . $sPath . "', $jQueryNs('" . $sContext . "'))"; |
70 | - } |
|
71 | - else |
|
69 | + } else |
|
72 | 70 | { |
73 | 71 | $this->sPath = "$jQueryNs('" . $sPath . "')"; |
74 | 72 | } |
@@ -87,7 +87,7 @@ |
||
87 | 87 | public function selector(string $sPath = '', string $sContext = ''): DomSelector |
88 | 88 | { |
89 | 89 | $xSelector = new DomSelector($this->jQueryNs, $sPath, $sContext); |
90 | - if($this->bCommand && $this->response() !== null) |
|
90 | + if ($this->bCommand && $this->response() !== null) |
|
91 | 91 | { |
92 | 92 | $this->addCommand(['cmd' => 'jquery'], $xSelector); |
93 | 93 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | */ |
71 | 71 | public function shallIncludeAssets(Plugin $xPlugin): bool |
72 | 72 | { |
73 | - if($this->xConfigManager->getOption('assets.include.all', true)) |
|
73 | + if ($this->xConfigManager->getOption('assets.include.all', true)) |
|
74 | 74 | { |
75 | 75 | return true; |
76 | 76 | } |
@@ -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->hasOption('js.app.uri') || |
145 | 145 | !$this->xConfigManager->hasOption('js.app.dir')) |
146 | 146 | { |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | $sJsFileName = $this->xConfigManager->getOption('js.app.file', $sHash); |
164 | 164 | $sJsDirectory = rtrim($this->xConfigManager->getOption('js.app.dir'), '\/') . DIRECTORY_SEPARATOR; |
165 | 165 | // - The js.app.dir must be writable |
166 | - if(!$sJsFileName || !is_dir($sJsDirectory) || !is_writable($sJsDirectory)) |
|
166 | + if (!$sJsFileName || !is_dir($sJsDirectory) || !is_writable($sJsDirectory)) |
|
167 | 167 | { |
168 | 168 | return ''; |
169 | 169 | } |
@@ -171,15 +171,15 @@ discard block |
||
171 | 171 | $sJsFilePath = $sJsDirectory . $sJsFileName . '.js'; |
172 | 172 | $sJsMinFilePath = $sJsDirectory . $sJsFileName . '.min.js'; |
173 | 173 | $sJsFileUri = rtrim($this->xConfigManager->getOption('js.app.uri'), '/') . "/$sJsFileName"; |
174 | - if(!is_file($sJsFilePath) && !@file_put_contents($sJsFilePath, $sJsCode)) |
|
174 | + if (!is_file($sJsFilePath) && !@file_put_contents($sJsFilePath, $sJsCode)) |
|
175 | 175 | { |
176 | 176 | return ''; |
177 | 177 | } |
178 | - if(!$this->xConfigManager->getOption('js.app.minify', false)) |
|
178 | + if (!$this->xConfigManager->getOption('js.app.minify', false)) |
|
179 | 179 | { |
180 | 180 | return $sJsFileUri . '.js'; |
181 | 181 | } |
182 | - if(!is_file($sJsMinFilePath) && !$this->xMinifier->minify($sJsFilePath, $sJsMinFilePath)) |
|
182 | + if (!is_file($sJsMinFilePath) && !$this->xMinifier->minify($sJsFilePath, $sJsMinFilePath)) |
|
183 | 183 | { |
184 | 184 | // If the file cannot be minified, return the plain js file. |
185 | 185 | return $sJsFileUri . '.js'; |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | private function generatePluginCodes(string $sClassName) |
142 | 142 | { |
143 | 143 | $xGenerator = $this->di->g($sClassName); |
144 | - if(!is_subclass_of($xGenerator, Plugin::class) || $this->xAssetManager->shallIncludeAssets($xGenerator)) |
|
144 | + if (!is_subclass_of($xGenerator, Plugin::class) || $this->xAssetManager->shallIncludeAssets($xGenerator)) |
|
145 | 145 | { |
146 | 146 | // HTML tags for CSS |
147 | 147 | $this->sCss = trim($this->sCss) . "\n" . trim($xGenerator->getCss(), " \n"); |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | } |
151 | 151 | // Javascript code |
152 | 152 | $this->sJsScript = trim($this->sJsScript) . "\n\n" . trim($xGenerator->getScript(), " \n"); |
153 | - if($xGenerator->readyEnabled()) |
|
153 | + if ($xGenerator->readyEnabled()) |
|
154 | 154 | { |
155 | 155 | $sScriptAttr = $xGenerator->readyInlined() ? 'sJsInlineScript' : 'sJsReadyScript'; |
156 | 156 | $this->$sScriptAttr = trim($this->$sScriptAttr) . "\n\n" . trim($xGenerator->getReadyScript(), " \n"); |
@@ -169,11 +169,11 @@ discard block |
||
169 | 169 | $this->sJsScript = trim($this->sJsScript, " \n"); |
170 | 170 | $this->sJsReadyScript = trim($this->sJsReadyScript, " \n"); |
171 | 171 | $this->sJsInlineScript = trim($this->sJsInlineScript, " \n"); |
172 | - if(($this->sJsReadyScript)) |
|
172 | + if (($this->sJsReadyScript)) |
|
173 | 173 | { |
174 | 174 | $this->sJsReadyScript = $this->render('ready.js', ['sScript' => $this->sJsReadyScript . "\n"]); |
175 | 175 | } |
176 | - if(($this->sJsInlineScript)) |
|
176 | + if (($this->sJsInlineScript)) |
|
177 | 177 | { |
178 | 178 | $this->sJsInlineScript = $this->render('ready.js', ['sScript' => $this->sJsInlineScript . "\n"]); |
179 | 179 | } |
@@ -189,14 +189,14 @@ discard block |
||
189 | 189 | */ |
190 | 190 | private function generateCodes() |
191 | 191 | { |
192 | - if($this->bGenerated) |
|
192 | + if ($this->bGenerated) |
|
193 | 193 | { |
194 | 194 | return; |
195 | 195 | } |
196 | 196 | |
197 | 197 | $this->xAssetManager = $this->di->getAssetManager(); |
198 | 198 | $this->sJsOptions = $this->xAssetManager->getJsOptions(); |
199 | - foreach($this->xPluginManager->getCodeGenerators() as $sClassName) |
|
199 | + foreach ($this->xPluginManager->getCodeGenerators() as $sClassName) |
|
200 | 200 | { |
201 | 201 | $this->generatePluginCodes($sClassName); |
202 | 202 | } |
@@ -241,11 +241,11 @@ discard block |
||
241 | 241 | { |
242 | 242 | $this->generateCodes(); |
243 | 243 | $sScript = ''; |
244 | - if(($bIncludeCss)) |
|
244 | + if (($bIncludeCss)) |
|
245 | 245 | { |
246 | 246 | $sScript .= $this->getCss() . "\n"; |
247 | 247 | } |
248 | - if(($bIncludeJs)) |
|
248 | + if (($bIncludeJs)) |
|
249 | 249 | { |
250 | 250 | $sScript .= $this->getJs() . "\n"; |
251 | 251 | } |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | $sJsConfigVars = $this->render('config.js', $this->xAssetManager->getOptionVars()); |
254 | 254 | // These three parts are always rendered together |
255 | 255 | $sJsScript = trim($sJsConfigVars) . "\n\n" . trim($this->sJsScript) . "\n\n" . trim($this->sJsReadyScript); |
256 | - if($this->xAssetManager->shallCreateJsFiles() && |
|
256 | + if ($this->xAssetManager->shallCreateJsFiles() && |
|
257 | 257 | ($sUrl = $this->xAssetManager->createJsFiles($this->getHash(), $sJsScript))) |
258 | 258 | { |
259 | 259 | return trim($sScript) . "\n\n" . trim($this->render('include.js', ['sUrl' => $sUrl])) . "\n\n" . |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | public function addCodeGenerator(string $sClassName, int $nPriority) |
106 | 106 | { |
107 | - while(isset($this->aCodeGenerators[$nPriority])) |
|
107 | + while (isset($this->aCodeGenerators[$nPriority])) |
|
108 | 108 | { |
109 | 109 | $nPriority++; |
110 | 110 | } |
@@ -152,28 +152,28 @@ discard block |
||
152 | 152 | { |
153 | 153 | $bIsUsed = false; |
154 | 154 | $aInterfaces = class_implements($sClassName); |
155 | - if(in_array(CodeGeneratorInterface::class, $aInterfaces)) |
|
155 | + if (in_array(CodeGeneratorInterface::class, $aInterfaces)) |
|
156 | 156 | { |
157 | 157 | $this->addCodeGenerator($sClassName, $nPriority); |
158 | 158 | $bIsUsed = true; |
159 | 159 | } |
160 | - if(in_array(CallableRegistryInterface::class, $aInterfaces)) |
|
160 | + if (in_array(CallableRegistryInterface::class, $aInterfaces)) |
|
161 | 161 | { |
162 | 162 | $this->aRegistryPlugins[$sPluginName] = $sClassName; |
163 | 163 | $bIsUsed = true; |
164 | 164 | } |
165 | - if(in_array(RequestHandlerInterface::class, $aInterfaces)) |
|
165 | + if (in_array(RequestHandlerInterface::class, $aInterfaces)) |
|
166 | 166 | { |
167 | 167 | $this->aRequestHandlers[$sPluginName] = $sClassName; |
168 | 168 | $bIsUsed = true; |
169 | 169 | } |
170 | - if(in_array(ResponsePluginInterface::class, $aInterfaces)) |
|
170 | + if (in_array(ResponsePluginInterface::class, $aInterfaces)) |
|
171 | 171 | { |
172 | 172 | $this->aResponsePlugins[$sPluginName] = $sClassName; |
173 | 173 | $bIsUsed = true; |
174 | 174 | } |
175 | 175 | |
176 | - if(!$bIsUsed) |
|
176 | + if (!$bIsUsed) |
|
177 | 177 | { |
178 | 178 | // The class is invalid. |
179 | 179 | $sMessage = $this->xTranslator->trans('errors.register.invalid', ['name' => $sClassName]); |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | } |
182 | 182 | |
183 | 183 | // Register the plugin in the DI container, if necessary |
184 | - if(!$this->di->has($sClassName)) |
|
184 | + if (!$this->di->has($sClassName)) |
|
185 | 185 | { |
186 | 186 | $this->di->auto($sClassName); |
187 | 187 | } |
@@ -197,12 +197,12 @@ discard block |
||
197 | 197 | */ |
198 | 198 | public function getResponsePlugin(string $sName, ?Response $xResponse = null): ?ResponsePlugin |
199 | 199 | { |
200 | - if(!isset($this->aResponsePlugins[$sName])) |
|
200 | + if (!isset($this->aResponsePlugins[$sName])) |
|
201 | 201 | { |
202 | 202 | return null; |
203 | 203 | } |
204 | 204 | $xPlugin = $this->di->g($this->aResponsePlugins[$sName]); |
205 | - if(($xResponse)) |
|
205 | + if (($xResponse)) |
|
206 | 206 | { |
207 | 207 | $xPlugin->setResponse($xResponse); |
208 | 208 | } |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | */ |
224 | 224 | public function registerCallable(string $sType, string $sCallable, $xOptions = []) |
225 | 225 | { |
226 | - if(isset($this->aRegistryPlugins[$sType]) && |
|
226 | + if (isset($this->aRegistryPlugins[$sType]) && |
|
227 | 227 | ($xPlugin = $this->di->g($this->aRegistryPlugins[$sType]))) |
228 | 228 | { |
229 | 229 | $xPlugin->register($sType, $sCallable, $xPlugin->checkOptions($sCallable, $xOptions)); |
@@ -85,28 +85,28 @@ discard block |
||
85 | 85 | private function updateContainer(Config $xConfig) |
86 | 86 | { |
87 | 87 | $aOptions = $xConfig->getOption('container.set', []); |
88 | - foreach($aOptions as $xKey => $xValue) |
|
88 | + foreach ($aOptions as $xKey => $xValue) |
|
89 | 89 | { |
90 | 90 | // The key is the class name. It must be a string. |
91 | - $this->di->set((string)$xKey, $xValue); |
|
91 | + $this->di->set((string) $xKey, $xValue); |
|
92 | 92 | } |
93 | 93 | $aOptions = $xConfig->getOption('container.val', []); |
94 | - foreach($aOptions as $xKey => $xValue) |
|
94 | + foreach ($aOptions as $xKey => $xValue) |
|
95 | 95 | { |
96 | 96 | // The key is the class name. It must be a string. |
97 | - $this->di->val((string)$xKey, $xValue); |
|
97 | + $this->di->val((string) $xKey, $xValue); |
|
98 | 98 | } |
99 | 99 | $aOptions = $xConfig->getOption('container.auto', []); |
100 | - foreach($aOptions as $xValue) |
|
100 | + foreach ($aOptions as $xValue) |
|
101 | 101 | { |
102 | 102 | // The key is the class name. It must be a string. |
103 | - $this->di->auto((string)$xValue); |
|
103 | + $this->di->auto((string) $xValue); |
|
104 | 104 | } |
105 | 105 | $aOptions = $xConfig->getOption('container.alias', []); |
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->alias((string)$xKey, (string)$xValue); |
|
109 | + $this->di->alias((string) $xKey, (string) $xValue); |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | |
@@ -121,14 +121,14 @@ discard block |
||
121 | 121 | */ |
122 | 122 | private function registerCallables(array $aOptions, string $sCallableType) |
123 | 123 | { |
124 | - foreach($aOptions as $xKey => $xValue) |
|
124 | + foreach ($aOptions as $xKey => $xValue) |
|
125 | 125 | { |
126 | - if(is_integer($xKey) && is_string($xValue)) |
|
126 | + if (is_integer($xKey) && is_string($xValue)) |
|
127 | 127 | { |
128 | 128 | // Register a function without options |
129 | 129 | $this->xPluginManager->registerCallable($sCallableType, $xValue); |
130 | 130 | } |
131 | - elseif(is_string($xKey) && (is_array($xValue) || is_string($xValue))) |
|
131 | + elseif (is_string($xKey) && (is_array($xValue) || is_string($xValue))) |
|
132 | 132 | { |
133 | 133 | // Register a function with options |
134 | 134 | $this->xPluginManager->registerCallable($sCallableType, $xKey, $xValue); |
@@ -171,12 +171,12 @@ discard block |
||
171 | 171 | { |
172 | 172 | // $this->aPackages contains packages config file paths. |
173 | 173 | $aLibOptions = $sClassName::config(); |
174 | - if(is_string($aLibOptions)) |
|
174 | + if (is_string($aLibOptions)) |
|
175 | 175 | { |
176 | 176 | // A string is supposed to be the path to a config file. |
177 | 177 | $aLibOptions = $this->xConfigManager->read($aLibOptions); |
178 | 178 | } |
179 | - elseif(!is_array($aLibOptions)) |
|
179 | + elseif (!is_array($aLibOptions)) |
|
180 | 180 | { |
181 | 181 | // Otherwise, anything else than an array is not accepted. |
182 | 182 | $sMessage = $this->xTranslator->trans('errors.register.invalid', ['name' => $sClassName]); |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | public function registerPackage(string $sClassName, array $aUserOptions) |
198 | 198 | { |
199 | 199 | $sClassName = trim($sClassName, '\\ '); |
200 | - if(!is_subclass_of($sClassName, Package::class)) |
|
200 | + if (!is_subclass_of($sClassName, Package::class)) |
|
201 | 201 | { |
202 | 202 | $sMessage = $this->xTranslator->trans('errors.register.invalid', ['name' => $sClassName]); |
203 | 203 | throw new SetupException($sMessage); |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | |
242 | 242 | // Register packages |
243 | 243 | $aPackageConfig = $xAppConfig->getOption('packages', []); |
244 | - foreach($aPackageConfig as $sClassName => $aPkgOptions) |
|
244 | + foreach ($aPackageConfig as $sClassName => $aPkgOptions) |
|
245 | 245 | { |
246 | 246 | $this->registerPackage($sClassName, $aPkgOptions); |
247 | 247 | } |
@@ -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]); |