@@ -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)); |