@@ -132,32 +132,32 @@ discard block |
||
| 132 | 132 | { |
| 133 | 133 | $bIsAlert = ($xPlugin instanceof \Jaxon\Dialog\Interfaces\Alert); |
| 134 | 134 | $bIsConfirm = ($xPlugin instanceof \Jaxon\Dialog\Interfaces\Confirm); |
| 135 | - if($xPlugin instanceof Request) |
|
| 135 | + if ($xPlugin instanceof Request) |
|
| 136 | 136 | { |
| 137 | 137 | // The name of a request plugin is used as key in the plugin table |
| 138 | 138 | $this->aRequestPlugins[$xPlugin->getName()] = $xPlugin; |
| 139 | 139 | } |
| 140 | - elseif($xPlugin instanceof Response) |
|
| 140 | + elseif ($xPlugin instanceof Response) |
|
| 141 | 141 | { |
| 142 | 142 | // The name of a response plugin is used as key in the plugin table |
| 143 | 143 | $this->aResponsePlugins[$xPlugin->getName()] = $xPlugin; |
| 144 | 144 | } |
| 145 | - elseif(!$bIsConfirm && !$bIsAlert) |
|
| 145 | + elseif (!$bIsConfirm && !$bIsAlert) |
|
| 146 | 146 | { |
| 147 | 147 | throw new \Jaxon\Exception\Error($this->trans('errors.register.invalid', ['name' => get_class($xPlugin)])); |
| 148 | 148 | } |
| 149 | 149 | // This plugin implements the Alert interface |
| 150 | - if($bIsAlert) |
|
| 150 | + if ($bIsAlert) |
|
| 151 | 151 | { |
| 152 | 152 | jaxon()->dialog()->setAlert($xPlugin); |
| 153 | 153 | } |
| 154 | 154 | // This plugin implements the Confirm interface |
| 155 | - if($bIsConfirm) |
|
| 155 | + if ($bIsConfirm) |
|
| 156 | 156 | { |
| 157 | 157 | jaxon()->dialog()->setConfirm($xPlugin); |
| 158 | 158 | } |
| 159 | 159 | // Register the plugin as an event listener |
| 160 | - if($xPlugin instanceof \Jaxon\Utils\Interfaces\EventListener) |
|
| 160 | + if ($xPlugin instanceof \Jaxon\Utils\Interfaces\EventListener) |
|
| 161 | 161 | { |
| 162 | 162 | $this->addEventListener($xPlugin); |
| 163 | 163 | } |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | */ |
| 193 | 193 | public function register($sType, $sCallable, $aOptions = []) |
| 194 | 194 | { |
| 195 | - if(!key_exists($sType, $this->aRequestPlugins)) |
|
| 195 | + if (!key_exists($sType, $this->aRequestPlugins)) |
|
| 196 | 196 | { |
| 197 | 197 | throw new \Jaxon\Exception\Error($this->trans('errors.register.plugin', ['name' => $sType])); |
| 198 | 198 | } |
@@ -220,15 +220,15 @@ discard block |
||
| 220 | 220 | { |
| 221 | 221 | // Register user functions |
| 222 | 222 | $aFunctionsConfig = $xAppConfig->getOption('functions', []); |
| 223 | - foreach($aFunctionsConfig as $xKey => $xValue) |
|
| 223 | + foreach ($aFunctionsConfig as $xKey => $xValue) |
|
| 224 | 224 | { |
| 225 | - if(is_integer($xKey) && is_string($xValue)) |
|
| 225 | + if (is_integer($xKey) && is_string($xValue)) |
|
| 226 | 226 | { |
| 227 | 227 | $sFunction = $xValue; |
| 228 | 228 | // Register a function without options |
| 229 | 229 | $this->register(Jaxon::USER_FUNCTION, $sFunction); |
| 230 | 230 | } |
| 231 | - elseif(is_string($xKey) && is_array($xValue)) |
|
| 231 | + elseif (is_string($xKey) && is_array($xValue)) |
|
| 232 | 232 | { |
| 233 | 233 | $sFunction = $xKey; |
| 234 | 234 | $aOptions = $xValue; |
@@ -244,25 +244,25 @@ discard block |
||
| 244 | 244 | |
| 245 | 245 | // Register classes and directories |
| 246 | 246 | $aClassesConfig = $xAppConfig->getOption('classes', []); |
| 247 | - foreach($aClassesConfig as $xKey => $xValue) |
|
| 247 | + foreach ($aClassesConfig as $xKey => $xValue) |
|
| 248 | 248 | { |
| 249 | - if(is_integer($xKey) && is_string($xValue)) |
|
| 249 | + if (is_integer($xKey) && is_string($xValue)) |
|
| 250 | 250 | { |
| 251 | 251 | $sClass = $xValue; |
| 252 | 252 | // Register a class without options |
| 253 | 253 | $this->register(Jaxon::CALLABLE_CLASS, $sClass); |
| 254 | 254 | } |
| 255 | - elseif(is_string($xKey) && is_array($xValue)) |
|
| 255 | + elseif (is_string($xKey) && is_array($xValue)) |
|
| 256 | 256 | { |
| 257 | 257 | $sClass = $xKey; |
| 258 | 258 | $aOptions = $xValue; |
| 259 | 259 | // Register a class with options |
| 260 | 260 | $this->register(Jaxon::CALLABLE_CLASS, $sClass, $aOptions); |
| 261 | 261 | } |
| 262 | - elseif(is_integer($xKey) && is_array($xValue)) |
|
| 262 | + elseif (is_integer($xKey) && is_array($xValue)) |
|
| 263 | 263 | { |
| 264 | 264 | // The directory path is required |
| 265 | - if(!key_exists('directory', $xValue)) |
|
| 265 | + if (!key_exists('directory', $xValue)) |
|
| 266 | 266 | { |
| 267 | 267 | continue; |
| 268 | 268 | // Todo: throw an exception |
@@ -270,17 +270,17 @@ discard block |
||
| 270 | 270 | // Registering a directory |
| 271 | 271 | $sDirectory = $xValue['directory']; |
| 272 | 272 | $aOptions = []; |
| 273 | - if(key_exists('options', $xValue) && |
|
| 273 | + if (key_exists('options', $xValue) && |
|
| 274 | 274 | is_array($xValue['options']) || is_string($xValue['options'])) |
| 275 | 275 | { |
| 276 | 276 | $aOptions = $xValue['options']; |
| 277 | 277 | } |
| 278 | 278 | // Setup directory options |
| 279 | - if(key_exists('namespace', $xValue)) |
|
| 279 | + if (key_exists('namespace', $xValue)) |
|
| 280 | 280 | { |
| 281 | 281 | $aOptions['namespace'] = $xValue['namespace']; |
| 282 | 282 | } |
| 283 | - if(key_exists('separator', $xValue)) |
|
| 283 | + if (key_exists('separator', $xValue)) |
|
| 284 | 284 | { |
| 285 | 285 | $aOptions['separator'] = $xValue['separator']; |
| 286 | 286 | } |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | */ |
| 306 | 306 | public function getResponsePlugin($sName) |
| 307 | 307 | { |
| 308 | - if(array_key_exists($sName, $this->aResponsePlugins)) |
|
| 308 | + if (array_key_exists($sName, $this->aResponsePlugins)) |
|
| 309 | 309 | { |
| 310 | 310 | return $this->aResponsePlugins[$sName]; |
| 311 | 311 | } |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | */ |
| 322 | 322 | public function getRequestPlugin($sName) |
| 323 | 323 | { |
| 324 | - if(array_key_exists($sName, $this->aRequestPlugins)) |
|
| 324 | + if (array_key_exists($sName, $this->aRequestPlugins)) |
|
| 325 | 325 | { |
| 326 | 326 | return $this->aRequestPlugins[$sName]; |
| 327 | 327 | } |
@@ -136,13 +136,11 @@ discard block |
||
| 136 | 136 | { |
| 137 | 137 | // The name of a request plugin is used as key in the plugin table |
| 138 | 138 | $this->aRequestPlugins[$xPlugin->getName()] = $xPlugin; |
| 139 | - } |
|
| 140 | - elseif($xPlugin instanceof Response) |
|
| 139 | + } elseif($xPlugin instanceof Response) |
|
| 141 | 140 | { |
| 142 | 141 | // The name of a response plugin is used as key in the plugin table |
| 143 | 142 | $this->aResponsePlugins[$xPlugin->getName()] = $xPlugin; |
| 144 | - } |
|
| 145 | - elseif(!$bIsConfirm && !$bIsAlert) |
|
| 143 | + } elseif(!$bIsConfirm && !$bIsAlert) |
|
| 146 | 144 | { |
| 147 | 145 | throw new \Jaxon\Exception\Error($this->trans('errors.register.invalid', ['name' => get_class($xPlugin)])); |
| 148 | 146 | } |
@@ -227,15 +225,13 @@ discard block |
||
| 227 | 225 | $sFunction = $xValue; |
| 228 | 226 | // Register a function without options |
| 229 | 227 | $this->register(Jaxon::USER_FUNCTION, $sFunction); |
| 230 | - } |
|
| 231 | - elseif(is_string($xKey) && is_array($xValue)) |
|
| 228 | + } elseif(is_string($xKey) && is_array($xValue)) |
|
| 232 | 229 | { |
| 233 | 230 | $sFunction = $xKey; |
| 234 | 231 | $aOptions = $xValue; |
| 235 | 232 | // Register a function with options |
| 236 | 233 | $this->register(Jaxon::USER_FUNCTION, $sFunction, $aOptions); |
| 237 | - } |
|
| 238 | - else |
|
| 234 | + } else |
|
| 239 | 235 | { |
| 240 | 236 | continue; |
| 241 | 237 | // Todo: throw an exception |
@@ -251,15 +247,13 @@ discard block |
||
| 251 | 247 | $sClass = $xValue; |
| 252 | 248 | // Register a class without options |
| 253 | 249 | $this->register(Jaxon::CALLABLE_CLASS, $sClass); |
| 254 | - } |
|
| 255 | - elseif(is_string($xKey) && is_array($xValue)) |
|
| 250 | + } elseif(is_string($xKey) && is_array($xValue)) |
|
| 256 | 251 | { |
| 257 | 252 | $sClass = $xKey; |
| 258 | 253 | $aOptions = $xValue; |
| 259 | 254 | // Register a class with options |
| 260 | 255 | $this->register(Jaxon::CALLABLE_CLASS, $sClass, $aOptions); |
| 261 | - } |
|
| 262 | - elseif(is_integer($xKey) && is_array($xValue)) |
|
| 256 | + } elseif(is_integer($xKey) && is_array($xValue)) |
|
| 263 | 257 | { |
| 264 | 258 | // The directory path is required |
| 265 | 259 | if(!key_exists('directory', $xValue)) |
@@ -286,8 +280,7 @@ discard block |
||
| 286 | 280 | } |
| 287 | 281 | // Register a class without options |
| 288 | 282 | $this->register(Jaxon::CALLABLE_DIR, $sDirectory, $aOptions); |
| 289 | - } |
|
| 290 | - else |
|
| 283 | + } else |
|
| 291 | 284 | { |
| 292 | 285 | continue; |
| 293 | 286 | // Todo: throw an exception |