@@ -26,12 +26,12 @@ |
||
| 26 | 26 | public static function read($sConfigFile) |
| 27 | 27 | { |
| 28 | 28 | $sConfigFile = realpath($sConfigFile); |
| 29 | - if(!is_readable($sConfigFile)) |
|
| 29 | + if (!is_readable($sConfigFile)) |
|
| 30 | 30 | { |
| 31 | 31 | throw new \Jaxon\Config\Exception\File(jaxon_trans('config.errors.file.access', array('path' => $sConfigFile))); |
| 32 | 32 | } |
| 33 | 33 | $aConfigOptions = include($sConfigFile); |
| 34 | - if(!is_array($aConfigOptions)) |
|
| 34 | + if (!is_array($aConfigOptions)) |
|
| 35 | 35 | { |
| 36 | 36 | throw new \Jaxon\Config\Exception\File(jaxon_trans('config.errors.file.content', array('path' => $sConfigFile))); |
| 37 | 37 | } |
@@ -45,14 +45,14 @@ discard block |
||
| 45 | 45 | $sPrefix = trim((string)$sPrefix); |
| 46 | 46 | $nDepth = intval($nDepth); |
| 47 | 47 | // Check the max depth |
| 48 | - if($nDepth < 0 || $nDepth > 9) |
|
| 48 | + if ($nDepth < 0 || $nDepth > 9) |
|
| 49 | 49 | { |
| 50 | 50 | throw new \Jaxon\Config\Exception\Data(jaxon_trans('config.errors.data.depth', |
| 51 | 51 | array('key' => $sPrefix, 'depth' => $nDepth))); |
| 52 | 52 | } |
| 53 | - foreach($aOptions as $sName => $xOption) |
|
| 53 | + foreach ($aOptions as $sName => $xOption) |
|
| 54 | 54 | { |
| 55 | - if(is_int($sName)) |
|
| 55 | + if (is_int($sName)) |
|
| 56 | 56 | { |
| 57 | 57 | continue; |
| 58 | 58 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | // Save the value of this option |
| 63 | 63 | $this->aOptions[$sFullName] = $xOption; |
| 64 | 64 | // Save the values of its sub-options |
| 65 | - if(is_array($xOption)) |
|
| 65 | + if (is_array($xOption)) |
|
| 66 | 66 | { |
| 67 | 67 | // Recursively read the options in the array |
| 68 | 68 | $this->_setOptions($xOption, $sFullName, $nDepth + 1); |
@@ -84,9 +84,9 @@ discard block |
||
| 84 | 84 | $aKeys = explode('.', (string)$sKeys); |
| 85 | 85 | foreach ($aKeys as $sKey) |
| 86 | 86 | { |
| 87 | - if(($sKey)) |
|
| 87 | + if (($sKey)) |
|
| 88 | 88 | { |
| 89 | - if(!array_key_exists($sKey, $aOptions) || !is_array($aOptions[$sKey])) |
|
| 89 | + if (!array_key_exists($sKey, $aOptions) || !is_array($aOptions[$sKey])) |
|
| 90 | 90 | { |
| 91 | 91 | return; |
| 92 | 92 | } |
@@ -134,13 +134,12 @@ discard block |
||
| 134 | 134 | $sPrefix = rtrim($sPrefix, '.') . '.'; |
| 135 | 135 | $sPrefixLen = strlen($sPrefix); |
| 136 | 136 | $aOptions = []; |
| 137 | - foreach($this->aOptions as $sName => $xValue) |
|
| 137 | + foreach ($this->aOptions as $sName => $xValue) |
|
| 138 | 138 | { |
| 139 | - if(substr($sName, 0, $sPrefixLen) == $sPrefix) |
|
| 139 | + if (substr($sName, 0, $sPrefixLen) == $sPrefix) |
|
| 140 | 140 | { |
| 141 | 141 | $iNextDotPos = strpos($sName, '.', $sPrefixLen); |
| 142 | - $sOptionName = $iNextDotPos === false ? substr($sName, $sPrefixLen) : |
|
| 143 | - substr($sName, $sPrefixLen, $iNextDotPos - $sPrefixLen); |
|
| 142 | + $sOptionName = $iNextDotPos === false ? substr($sName, $sPrefixLen) : substr($sName, $sPrefixLen, $iNextDotPos - $sPrefixLen); |
|
| 144 | 143 | $aOptions[$sOptionName] = $sPrefix . $sOptionName; |
| 145 | 144 | } |
| 146 | 145 | } |
@@ -26,16 +26,16 @@ |
||
| 26 | 26 | public static function read($sConfigFile) |
| 27 | 27 | { |
| 28 | 28 | $sConfigFile = realpath($sConfigFile); |
| 29 | - if(!extension_loaded('yaml')) |
|
| 29 | + if (!extension_loaded('yaml')) |
|
| 30 | 30 | { |
| 31 | 31 | throw new \Jaxon\Config\Exception\Yaml(jaxon_trans('config.errors.yaml.install')); |
| 32 | 32 | } |
| 33 | - if(!is_readable($sConfigFile)) |
|
| 33 | + if (!is_readable($sConfigFile)) |
|
| 34 | 34 | { |
| 35 | 35 | throw new \Jaxon\Config\Exception\File(jaxon_trans('config.errors.file.access', array('path' => $sConfigFile))); |
| 36 | 36 | } |
| 37 | 37 | $aConfigOptions = yaml_parse_file($sConfigFile); |
| 38 | - if(!is_array($aConfigOptions)) |
|
| 38 | + if (!is_array($aConfigOptions)) |
|
| 39 | 39 | { |
| 40 | 40 | throw new \Jaxon\Config\Exception\File(jaxon_trans('config.errors.file.content', array('path' => $sConfigFile))); |
| 41 | 41 | } |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | public function read($sConfigFile) |
| 25 | 25 | { |
| 26 | 26 | $sExt = pathinfo($sConfigFile, PATHINFO_EXTENSION); |
| 27 | - switch($sExt) |
|
| 27 | + switch ($sExt) |
|
| 28 | 28 | { |
| 29 | 29 | case 'php': |
| 30 | 30 | $aConfigOptions = Php::read($sConfigFile); |
@@ -26,13 +26,13 @@ |
||
| 26 | 26 | public static function read($sConfigFile) |
| 27 | 27 | { |
| 28 | 28 | $sConfigFile = realpath($sConfigFile); |
| 29 | - if(!is_readable($sConfigFile)) |
|
| 29 | + if (!is_readable($sConfigFile)) |
|
| 30 | 30 | { |
| 31 | 31 | throw new \Jaxon\Config\Exception\File(jaxon_trans('config.errors.file.access', array('path' => $sConfigFile))); |
| 32 | 32 | } |
| 33 | 33 | $sFileContent = file_get_contents($sConfigFile); |
| 34 | 34 | $aConfigOptions = json_decode($sFileContent, true); |
| 35 | - if(!is_array($aConfigOptions)) |
|
| 35 | + if (!is_array($aConfigOptions)) |
|
| 36 | 36 | { |
| 37 | 37 | throw new \Jaxon\Config\Exception\File(jaxon_trans('config.errors.file.content', array('path' => $sConfigFile))); |
| 38 | 38 | } |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | /** |
| 304 | 304 | * Create a new the config manager |
| 305 | 305 | * |
| 306 | - * @return Jaxon\Config\Config The config manager |
|
| 306 | + * @return Config The config manager |
|
| 307 | 307 | */ |
| 308 | 308 | public function newConfig() |
| 309 | 309 | { |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | /** |
| 374 | 374 | * Set the pagination renderer |
| 375 | 375 | * |
| 376 | - * @param Jaxon\Utils\Pagination\Renderer $xRenderer The pagination renderer |
|
| 376 | + * @param PaginationRenderer $xRenderer The pagination renderer |
|
| 377 | 377 | * |
| 378 | 378 | * @return void |
| 379 | 379 | */ |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | /** |
| 406 | 406 | * Create a new Jaxon response object |
| 407 | 407 | * |
| 408 | - * @return Jaxon\Response\Response |
|
| 408 | + * @return Response |
|
| 409 | 409 | */ |
| 410 | 410 | public function newResponse() |
| 411 | 411 | { |
@@ -16,7 +16,6 @@ |
||
| 16 | 16 | |
| 17 | 17 | use Lemon\Event\EventDispatcher; |
| 18 | 18 | use Jaxon\Sentry\View\Renderer; |
| 19 | - |
|
| 20 | 19 | use Jaxon\Jaxon; |
| 21 | 20 | use Jaxon\Response\Response; |
| 22 | 21 | use Jaxon\Config\Config; |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | public static function getInstance() |
| 51 | 51 | { |
| 52 | - if(!self::$xInstance) |
|
| 52 | + if (!self::$xInstance) |
|
| 53 | 53 | { |
| 54 | 54 | self::$xInstance = new Container(); |
| 55 | 55 | } |
@@ -109,15 +109,15 @@ discard block |
||
| 109 | 109 | * Core library objects |
| 110 | 110 | */ |
| 111 | 111 | // Jaxon Core |
| 112 | - $this->coreContainer[Jaxon::class] = function ($c) { |
|
| 112 | + $this->coreContainer[Jaxon::class] = function($c) { |
|
| 113 | 113 | return new Jaxon(); |
| 114 | 114 | }; |
| 115 | 115 | // Global Response |
| 116 | - $this->coreContainer[Response::class] = function ($c) { |
|
| 116 | + $this->coreContainer[Response::class] = function($c) { |
|
| 117 | 117 | return new Response(); |
| 118 | 118 | }; |
| 119 | 119 | // Dialog |
| 120 | - $this->coreContainer[Dialog::class] = function ($c) { |
|
| 120 | + $this->coreContainer[Dialog::class] = function($c) { |
|
| 121 | 121 | return new Dialog(); |
| 122 | 122 | }; |
| 123 | 123 | |
@@ -125,41 +125,41 @@ discard block |
||
| 125 | 125 | * Managers |
| 126 | 126 | */ |
| 127 | 127 | // Callable objects repository |
| 128 | - $this->coreContainer[CallableRepository::class] = function ($c) { |
|
| 128 | + $this->coreContainer[CallableRepository::class] = function($c) { |
|
| 129 | 129 | return new CallableRepository(); |
| 130 | 130 | }; |
| 131 | 131 | // Plugin Manager |
| 132 | - $this->coreContainer[PluginManager::class] = function ($c) { |
|
| 132 | + $this->coreContainer[PluginManager::class] = function($c) { |
|
| 133 | 133 | return new PluginManager(); |
| 134 | 134 | }; |
| 135 | 135 | // Request Manager |
| 136 | - $this->coreContainer[RequestHandler::class] = function ($c) { |
|
| 136 | + $this->coreContainer[RequestHandler::class] = function($c) { |
|
| 137 | 137 | return new RequestHandler($c[PluginManager::class]); |
| 138 | 138 | }; |
| 139 | 139 | // Request Factory |
| 140 | - $this->coreContainer[RequestFactory::class] = function ($c) { |
|
| 140 | + $this->coreContainer[RequestFactory::class] = function($c) { |
|
| 141 | 141 | return new RequestFactory($c[CallableRepository::class]); |
| 142 | 142 | }; |
| 143 | 143 | // Parameter Factory |
| 144 | - $this->coreContainer[ParameterFactory::class] = function ($c) { |
|
| 144 | + $this->coreContainer[ParameterFactory::class] = function($c) { |
|
| 145 | 145 | return new ParameterFactory(); |
| 146 | 146 | }; |
| 147 | 147 | // Response Manager |
| 148 | - $this->coreContainer[ResponseManager::class] = function ($c) { |
|
| 148 | + $this->coreContainer[ResponseManager::class] = function($c) { |
|
| 149 | 149 | return new ResponseManager(); |
| 150 | 150 | }; |
| 151 | 151 | // Code Generator |
| 152 | - $this->coreContainer[CodeGenerator::class] = function ($c) { |
|
| 152 | + $this->coreContainer[CodeGenerator::class] = function($c) { |
|
| 153 | 153 | return new CodeGenerator($c[PluginManager::class]); |
| 154 | 154 | }; |
| 155 | 155 | |
| 156 | 156 | /* |
| 157 | 157 | * Config |
| 158 | 158 | */ |
| 159 | - $this->coreContainer[Config::class] = function ($c) { |
|
| 159 | + $this->coreContainer[Config::class] = function($c) { |
|
| 160 | 160 | return new Config(); |
| 161 | 161 | }; |
| 162 | - $this->coreContainer[ConfigReader::class] = function ($c) { |
|
| 162 | + $this->coreContainer[ConfigReader::class] = function($c) { |
|
| 163 | 163 | return new ConfigReader(); |
| 164 | 164 | }; |
| 165 | 165 | |
@@ -167,31 +167,31 @@ discard block |
||
| 167 | 167 | * Services |
| 168 | 168 | */ |
| 169 | 169 | // Minifier |
| 170 | - $this->coreContainer[Minifier::class] = function ($c) { |
|
| 170 | + $this->coreContainer[Minifier::class] = function($c) { |
|
| 171 | 171 | return new Minifier(); |
| 172 | 172 | }; |
| 173 | 173 | // Translator |
| 174 | - $this->coreContainer[Translator::class] = function ($c) { |
|
| 174 | + $this->coreContainer[Translator::class] = function($c) { |
|
| 175 | 175 | return new Translator($c['jaxon.core.translation_dir'], $c[Config::class]); |
| 176 | 176 | }; |
| 177 | 177 | // Template engine |
| 178 | - $this->coreContainer[Template::class] = function ($c) { |
|
| 178 | + $this->coreContainer[Template::class] = function($c) { |
|
| 179 | 179 | return new Template($c['jaxon.core.template_dir']); |
| 180 | 180 | }; |
| 181 | 181 | // Validator |
| 182 | - $this->coreContainer[Validator::class] = function ($c) { |
|
| 182 | + $this->coreContainer[Validator::class] = function($c) { |
|
| 183 | 183 | return new Validator($c[Translator::class], $c[Config::class]); |
| 184 | 184 | }; |
| 185 | 185 | // Pagination Renderer |
| 186 | - $this->coreContainer[PaginationRenderer::class] = function ($c) { |
|
| 186 | + $this->coreContainer[PaginationRenderer::class] = function($c) { |
|
| 187 | 187 | return new PaginationRenderer($c[Template::class]); |
| 188 | 188 | }; |
| 189 | 189 | // Pagination Paginator |
| 190 | - $this->coreContainer[Paginator::class] = function ($c) { |
|
| 190 | + $this->coreContainer[Paginator::class] = function($c) { |
|
| 191 | 191 | return new Paginator($c[PaginationRenderer::class]); |
| 192 | 192 | }; |
| 193 | 193 | // Event Dispatcher |
| 194 | - $this->coreContainer[EventDispatcher::class] = function ($c) { |
|
| 194 | + $this->coreContainer[EventDispatcher::class] = function($c) { |
|
| 195 | 195 | return new EventDispatcher(); |
| 196 | 196 | }; |
| 197 | 197 | |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | */ |
| 211 | 211 | public function get($sClass) |
| 212 | 212 | { |
| 213 | - if($this->sentryContainer != null && $this->sentryContainer->has($sClass)) |
|
| 213 | + if ($this->sentryContainer != null && $this->sentryContainer->has($sClass)) |
|
| 214 | 214 | { |
| 215 | 215 | return $this->sentryContainer->get($sClass); |
| 216 | 216 | } |
@@ -515,14 +515,14 @@ discard block |
||
| 515 | 515 | $this->coreContainer['jaxon.sentry.view.base.' . $sId] = $xClosure; |
| 516 | 516 | |
| 517 | 517 | // Return the initialized view renderer |
| 518 | - $this->coreContainer['jaxon.sentry.view.' . $sId] = function ($c) use ($sId) { |
|
| 518 | + $this->coreContainer['jaxon.sentry.view.' . $sId] = function($c) use ($sId) { |
|
| 519 | 519 | // Get the defined renderer |
| 520 | 520 | $renderer = $c['jaxon.sentry.view.base.' . $sId]; |
| 521 | 521 | // Init the renderer with the template namespaces |
| 522 | 522 | $aNamespaces = $this->coreContainer['jaxon.view.data.namespaces']; |
| 523 | - if(key_exists($sId, $aNamespaces)) |
|
| 523 | + if (key_exists($sId, $aNamespaces)) |
|
| 524 | 524 | { |
| 525 | - foreach($aNamespaces[$sId] as $ns) |
|
| 525 | + foreach ($aNamespaces[$sId] as $ns) |
|
| 526 | 526 | { |
| 527 | 527 | $renderer->addNamespace($ns['namespace'], $ns['directory'], $ns['extension']); |
| 528 | 528 | } |
@@ -540,7 +540,7 @@ discard block |
||
| 540 | 540 | */ |
| 541 | 541 | public function getViewRenderer($sId = '') |
| 542 | 542 | { |
| 543 | - if(!$sId) |
|
| 543 | + if (!$sId) |
|
| 544 | 544 | { |
| 545 | 545 | // Return the view renderer facade |
| 546 | 546 | return $this->coreContainer[\Jaxon\Sentry\View\Facade::class]; |
@@ -22,9 +22,7 @@ |
||
| 22 | 22 | namespace Jaxon\Plugin; |
| 23 | 23 | |
| 24 | 24 | use Jaxon\Jaxon; |
| 25 | -use Jaxon\Plugin\Package; |
|
| 26 | 25 | use Jaxon\Config\Config; |
| 27 | - |
|
| 28 | 26 | use Closure; |
| 29 | 27 | |
| 30 | 28 | class Manager |
@@ -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,14 +220,14 @@ 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 | // Register a function without options |
| 228 | 228 | $this->register(Jaxon::USER_FUNCTION, $xValue); |
| 229 | 229 | } |
| 230 | - elseif(is_string($xKey) && is_array($xValue)) |
|
| 230 | + elseif (is_string($xKey) && is_array($xValue)) |
|
| 231 | 231 | { |
| 232 | 232 | // Register a function with options |
| 233 | 233 | $this->register(Jaxon::USER_FUNCTION, $xKey, $xValue); |
@@ -241,22 +241,22 @@ discard block |
||
| 241 | 241 | |
| 242 | 242 | // Register classes and directories |
| 243 | 243 | $aClassesConfig = $xAppConfig->getOption('classes', []); |
| 244 | - foreach($aClassesConfig as $xKey => $xValue) |
|
| 244 | + foreach ($aClassesConfig as $xKey => $xValue) |
|
| 245 | 245 | { |
| 246 | - if(is_integer($xKey) && is_string($xValue)) |
|
| 246 | + if (is_integer($xKey) && is_string($xValue)) |
|
| 247 | 247 | { |
| 248 | 248 | // Register a class without options |
| 249 | 249 | $this->register(Jaxon::CALLABLE_CLASS, $xValue); |
| 250 | 250 | } |
| 251 | - elseif(is_string($xKey) && is_array($xValue)) |
|
| 251 | + elseif (is_string($xKey) && is_array($xValue)) |
|
| 252 | 252 | { |
| 253 | 253 | // Register a class with options |
| 254 | 254 | $this->register(Jaxon::CALLABLE_CLASS, $xKey, $aOptions); |
| 255 | 255 | } |
| 256 | - elseif(is_integer($xKey) && is_array($xValue)) |
|
| 256 | + elseif (is_integer($xKey) && is_array($xValue)) |
|
| 257 | 257 | { |
| 258 | 258 | // The directory path is required |
| 259 | - if(!key_exists('directory', $xValue)) |
|
| 259 | + if (!key_exists('directory', $xValue)) |
|
| 260 | 260 | { |
| 261 | 261 | continue; |
| 262 | 262 | // Todo: throw an exception |
@@ -264,17 +264,17 @@ discard block |
||
| 264 | 264 | // Registering a directory |
| 265 | 265 | $sDirectory = $xValue['directory']; |
| 266 | 266 | $aOptions = []; |
| 267 | - if(key_exists('options', $xValue) && |
|
| 267 | + if (key_exists('options', $xValue) && |
|
| 268 | 268 | is_array($xValue['options']) || is_string($xValue['options'])) |
| 269 | 269 | { |
| 270 | 270 | $aOptions = $xValue['options']; |
| 271 | 271 | } |
| 272 | 272 | // Setup directory options |
| 273 | - if(key_exists('namespace', $xValue)) |
|
| 273 | + if (key_exists('namespace', $xValue)) |
|
| 274 | 274 | { |
| 275 | 275 | $aOptions['namespace'] = $xValue['namespace']; |
| 276 | 276 | } |
| 277 | - if(key_exists('separator', $xValue)) |
|
| 277 | + if (key_exists('separator', $xValue)) |
|
| 278 | 278 | { |
| 279 | 279 | $aOptions['separator'] = $xValue['separator']; |
| 280 | 280 | } |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | */ |
| 300 | 300 | public function getResponsePlugin($sName) |
| 301 | 301 | { |
| 302 | - if(array_key_exists($sName, $this->aResponsePlugins)) |
|
| 302 | + if (array_key_exists($sName, $this->aResponsePlugins)) |
|
| 303 | 303 | { |
| 304 | 304 | return $this->aResponsePlugins[$sName]; |
| 305 | 305 | } |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | */ |
| 316 | 316 | public function getRequestPlugin($sName) |
| 317 | 317 | { |
| 318 | - if(array_key_exists($sName, $this->aRequestPlugins)) |
|
| 318 | + if (array_key_exists($sName, $this->aRequestPlugins)) |
|
| 319 | 319 | { |
| 320 | 320 | return $this->aRequestPlugins[$sName]; |
| 321 | 321 | } |
@@ -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 | } |
@@ -226,13 +224,11 @@ discard block |
||
| 226 | 224 | { |
| 227 | 225 | // Register a function without options |
| 228 | 226 | $this->register(Jaxon::USER_FUNCTION, $xValue); |
| 229 | - } |
|
| 230 | - elseif(is_string($xKey) && is_array($xValue)) |
|
| 227 | + } elseif(is_string($xKey) && is_array($xValue)) |
|
| 231 | 228 | { |
| 232 | 229 | // Register a function with options |
| 233 | 230 | $this->register(Jaxon::USER_FUNCTION, $xKey, $xValue); |
| 234 | - } |
|
| 235 | - else |
|
| 231 | + } else |
|
| 236 | 232 | { |
| 237 | 233 | continue; |
| 238 | 234 | // Todo: throw an exception |
@@ -247,13 +243,11 @@ discard block |
||
| 247 | 243 | { |
| 248 | 244 | // Register a class without options |
| 249 | 245 | $this->register(Jaxon::CALLABLE_CLASS, $xValue); |
| 250 | - } |
|
| 251 | - elseif(is_string($xKey) && is_array($xValue)) |
|
| 246 | + } elseif(is_string($xKey) && is_array($xValue)) |
|
| 252 | 247 | { |
| 253 | 248 | // Register a class with options |
| 254 | 249 | $this->register(Jaxon::CALLABLE_CLASS, $xKey, $aOptions); |
| 255 | - } |
|
| 256 | - elseif(is_integer($xKey) && is_array($xValue)) |
|
| 250 | + } elseif(is_integer($xKey) && is_array($xValue)) |
|
| 257 | 251 | { |
| 258 | 252 | // The directory path is required |
| 259 | 253 | if(!key_exists('directory', $xValue)) |
@@ -280,8 +274,7 @@ discard block |
||
| 280 | 274 | } |
| 281 | 275 | // Register a class without options |
| 282 | 276 | $this->register(Jaxon::CALLABLE_DIR, $sDirectory, $aOptions); |
| 283 | - } |
|
| 284 | - else |
|
| 277 | + } else |
|
| 285 | 278 | { |
| 286 | 279 | continue; |
| 287 | 280 | // Todo: throw an exception |
@@ -152,7 +152,7 @@ |
||
| 152 | 152 | * |
| 153 | 153 | * @param string $sArg The Jaxon request argument |
| 154 | 154 | * |
| 155 | - * @return mixed |
|
| 155 | + * @return string|null |
|
| 156 | 156 | */ |
| 157 | 157 | private function __argumentDecode(&$sArg) |
| 158 | 158 | { |
@@ -131,19 +131,19 @@ |
||
| 131 | 131 | $sValue = substr($sValue, 1); |
| 132 | 132 | switch ($cType) |
| 133 | 133 | { |
| 134 | - case 'S': |
|
| 135 | - $value = ($sValue === false ? '' : $sValue); |
|
| 136 | - break; |
|
| 137 | - case 'B': |
|
| 138 | - $value = $this->__convertStringToBool($sValue); |
|
| 139 | - break; |
|
| 140 | - case 'N': |
|
| 141 | - $value = ($sValue == floor($sValue) ? (int)$sValue : (float)$sValue); |
|
| 142 | - break; |
|
| 143 | - case '*': |
|
| 144 | - default: |
|
| 145 | - $value = null; |
|
| 146 | - break; |
|
| 134 | + case 'S': |
|
| 135 | + $value = ($sValue === false ? '' : $sValue); |
|
| 136 | + break; |
|
| 137 | + case 'B': |
|
| 138 | + $value = $this->__convertStringToBool($sValue); |
|
| 139 | + break; |
|
| 140 | + case 'N': |
|
| 141 | + $value = ($sValue == floor($sValue) ? (int)$sValue : (float)$sValue); |
|
| 142 | + break; |
|
| 143 | + case '*': |
|
| 144 | + default: |
|
| 145 | + $value = null; |
|
| 146 | + break; |
|
| 147 | 147 | } |
| 148 | 148 | return $value; |
| 149 | 149 | } |
@@ -63,17 +63,17 @@ discard block |
||
| 63 | 63 | $this->aArgs = []; |
| 64 | 64 | $this->nMethod = Jaxon::METHOD_UNKNOWN; |
| 65 | 65 | |
| 66 | - if(isset($_POST['jxnargs'])) |
|
| 66 | + if (isset($_POST['jxnargs'])) |
|
| 67 | 67 | { |
| 68 | 68 | $this->nMethod = Jaxon::METHOD_POST; |
| 69 | 69 | $this->aArgs = $_POST['jxnargs']; |
| 70 | 70 | } |
| 71 | - elseif(isset($_GET['jxnargs'])) |
|
| 71 | + elseif (isset($_GET['jxnargs'])) |
|
| 72 | 72 | { |
| 73 | 73 | $this->nMethod = Jaxon::METHOD_GET; |
| 74 | 74 | $this->aArgs = $_GET['jxnargs']; |
| 75 | 75 | } |
| 76 | - if(get_magic_quotes_gpc() == 1) |
|
| 76 | + if (get_magic_quotes_gpc() == 1) |
|
| 77 | 77 | { |
| 78 | 78 | array_walk($this->aArgs, array(&$this, '__argumentStripSlashes')); |
| 79 | 79 | } |
@@ -89,17 +89,17 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | private function __convertStringToBool($sValue) |
| 91 | 91 | { |
| 92 | - if(strcasecmp($sValue, 'true') == 0) |
|
| 92 | + if (strcasecmp($sValue, 'true') == 0) |
|
| 93 | 93 | { |
| 94 | 94 | return true; |
| 95 | 95 | } |
| 96 | - if(strcasecmp($sValue, 'false') == 0) |
|
| 96 | + if (strcasecmp($sValue, 'false') == 0) |
|
| 97 | 97 | { |
| 98 | 98 | return false; |
| 99 | 99 | } |
| 100 | - if(is_numeric($sValue)) |
|
| 100 | + if (is_numeric($sValue)) |
|
| 101 | 101 | { |
| 102 | - if($sValue == 0) |
|
| 102 | + if ($sValue == 0) |
|
| 103 | 103 | { |
| 104 | 104 | return false; |
| 105 | 105 | } |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | private function __argumentStripSlashes(&$sArg) |
| 119 | 119 | { |
| 120 | - if(!is_string($sArg)) |
|
| 120 | + if (!is_string($sArg)) |
|
| 121 | 121 | { |
| 122 | 122 | return ''; |
| 123 | 123 | } |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | */ |
| 166 | 166 | private function __argumentDecode(&$sArg) |
| 167 | 167 | { |
| 168 | - if($sArg == '') |
|
| 168 | + if ($sArg == '') |
|
| 169 | 169 | { |
| 170 | 170 | return ''; |
| 171 | 171 | } |
@@ -174,22 +174,22 @@ discard block |
||
| 174 | 174 | $sType = 'multipart/form-data'; |
| 175 | 175 | $iLen = strlen($sType); |
| 176 | 176 | $sContentType = ''; |
| 177 | - if(key_exists('CONTENT_TYPE', $_SERVER)) |
|
| 177 | + if (key_exists('CONTENT_TYPE', $_SERVER)) |
|
| 178 | 178 | { |
| 179 | 179 | $sContentType = substr($_SERVER['CONTENT_TYPE'], 0, $iLen); |
| 180 | 180 | } |
| 181 | - elseif(key_exists('HTTP_CONTENT_TYPE', $_SERVER)) |
|
| 181 | + elseif (key_exists('HTTP_CONTENT_TYPE', $_SERVER)) |
|
| 182 | 182 | { |
| 183 | 183 | $sContentType = substr($_SERVER['HTTP_CONTENT_TYPE'], 0, $iLen); |
| 184 | 184 | } |
| 185 | - if($sContentType == $sType) |
|
| 185 | + if ($sContentType == $sType) |
|
| 186 | 186 | { |
| 187 | 187 | $sArg = urldecode($sArg); |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | $data = json_decode($sArg, true); |
| 191 | 191 | |
| 192 | - if($data !== null && $sArg != $data) |
|
| 192 | + if ($data !== null && $sArg != $data) |
|
| 193 | 193 | { |
| 194 | 194 | $sArg = $data; |
| 195 | 195 | } |
@@ -208,13 +208,13 @@ discard block |
||
| 208 | 208 | */ |
| 209 | 209 | private function __argumentDecodeUTF8_iconv(&$mArg) |
| 210 | 210 | { |
| 211 | - if(is_array($mArg)) |
|
| 211 | + if (is_array($mArg)) |
|
| 212 | 212 | { |
| 213 | - foreach($mArg as $sKey => &$xArg) |
|
| 213 | + foreach ($mArg as $sKey => &$xArg) |
|
| 214 | 214 | { |
| 215 | 215 | $sNewKey = $sKey; |
| 216 | 216 | $this->__argumentDecodeUTF8_iconv($sNewKey); |
| 217 | - if($sNewKey != $sKey) |
|
| 217 | + if ($sNewKey != $sKey) |
|
| 218 | 218 | { |
| 219 | 219 | $mArg[$sNewKey] = $xArg; |
| 220 | 220 | unset($mArg[$sKey]); |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | $this->__argumentDecodeUTF8_iconv($xArg); |
| 224 | 224 | } |
| 225 | 225 | } |
| 226 | - elseif(is_string($mArg)) |
|
| 226 | + elseif (is_string($mArg)) |
|
| 227 | 227 | { |
| 228 | 228 | $mArg = iconv("UTF-8", $this->getOption('core.encoding') . '//TRANSLIT', $mArg); |
| 229 | 229 | } |
@@ -238,13 +238,13 @@ discard block |
||
| 238 | 238 | */ |
| 239 | 239 | private function __argumentDecodeUTF8_mb_convert_encoding(&$mArg) |
| 240 | 240 | { |
| 241 | - if(is_array($mArg)) |
|
| 241 | + if (is_array($mArg)) |
|
| 242 | 242 | { |
| 243 | - foreach($mArg as $sKey => &$xArg) |
|
| 243 | + foreach ($mArg as $sKey => &$xArg) |
|
| 244 | 244 | { |
| 245 | 245 | $sNewKey = $sKey; |
| 246 | 246 | $this->__argumentDecodeUTF8_mb_convert_encoding($sNewKey); |
| 247 | - if($sNewKey != $sKey) |
|
| 247 | + if ($sNewKey != $sKey) |
|
| 248 | 248 | { |
| 249 | 249 | $mArg[$sNewKey] = $xArg; |
| 250 | 250 | unset($mArg[$sKey]); |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | $this->__argumentDecodeUTF8_mb_convert_encoding($xArg); |
| 254 | 254 | } |
| 255 | 255 | } |
| 256 | - elseif(is_string($mArg)) |
|
| 256 | + elseif (is_string($mArg)) |
|
| 257 | 257 | { |
| 258 | 258 | $mArg = mb_convert_encoding($mArg, $this->getOption('core.encoding'), "UTF-8"); |
| 259 | 259 | } |
@@ -268,14 +268,14 @@ discard block |
||
| 268 | 268 | */ |
| 269 | 269 | private function __argumentDecodeUTF8_utf8_decode(&$mArg) |
| 270 | 270 | { |
| 271 | - if(is_array($mArg)) |
|
| 271 | + if (is_array($mArg)) |
|
| 272 | 272 | { |
| 273 | - foreach($mArg as $sKey => &$xArg) |
|
| 273 | + foreach ($mArg as $sKey => &$xArg) |
|
| 274 | 274 | { |
| 275 | 275 | $sNewKey = $sKey; |
| 276 | 276 | $this->__argumentDecodeUTF8_utf8_decode($sNewKey); |
| 277 | 277 | |
| 278 | - if($sNewKey != $sKey) |
|
| 278 | + if ($sNewKey != $sKey) |
|
| 279 | 279 | { |
| 280 | 280 | $mArg[$sNewKey] = $xArg; |
| 281 | 281 | unset($mArg[$sKey]); |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | $this->__argumentDecodeUTF8_utf8_decode($xArg); |
| 286 | 286 | } |
| 287 | 287 | } |
| 288 | - elseif(is_string($mArg)) |
|
| 288 | + elseif (is_string($mArg)) |
|
| 289 | 289 | { |
| 290 | 290 | $mArg = utf8_decode($mArg); |
| 291 | 291 | } |
@@ -310,19 +310,19 @@ discard block |
||
| 310 | 310 | */ |
| 311 | 311 | public function processArguments() |
| 312 | 312 | { |
| 313 | - if(($this->getOption('core.decode_utf8'))) |
|
| 313 | + if (($this->getOption('core.decode_utf8'))) |
|
| 314 | 314 | { |
| 315 | 315 | $sFunction = ''; |
| 316 | 316 | |
| 317 | - if(function_exists('iconv')) |
|
| 317 | + if (function_exists('iconv')) |
|
| 318 | 318 | { |
| 319 | 319 | $sFunction = "iconv"; |
| 320 | 320 | } |
| 321 | - elseif(function_exists('mb_convert_encoding')) |
|
| 321 | + elseif (function_exists('mb_convert_encoding')) |
|
| 322 | 322 | { |
| 323 | 323 | $sFunction = "mb_convert_encoding"; |
| 324 | 324 | } |
| 325 | - elseif($this->getOption('core.encoding') == "ISO-8859-1") |
|
| 325 | + elseif ($this->getOption('core.encoding') == "ISO-8859-1") |
|
| 326 | 326 | { |
| 327 | 327 | $sFunction = "utf8_decode"; |
| 328 | 328 | } |
@@ -349,9 +349,9 @@ discard block |
||
| 349 | 349 | */ |
| 350 | 350 | public function canProcessRequest() |
| 351 | 351 | { |
| 352 | - foreach($this->xPluginManager->getRequestPlugins() as $xPlugin) |
|
| 352 | + foreach ($this->xPluginManager->getRequestPlugins() as $xPlugin) |
|
| 353 | 353 | { |
| 354 | - if($xPlugin->getName() != Jaxon::FILE_UPLOAD && $xPlugin->canProcessRequest()) |
|
| 354 | + if ($xPlugin->getName() != Jaxon::FILE_UPLOAD && $xPlugin->canProcessRequest()) |
|
| 355 | 355 | { |
| 356 | 356 | return true; |
| 357 | 357 | } |
@@ -369,13 +369,13 @@ discard block |
||
| 369 | 369 | */ |
| 370 | 370 | public function processRequest() |
| 371 | 371 | { |
| 372 | - foreach($this->xPluginManager->getRequestPlugins() as $xPlugin) |
|
| 372 | + foreach ($this->xPluginManager->getRequestPlugins() as $xPlugin) |
|
| 373 | 373 | { |
| 374 | - if($xPlugin->getName() != Jaxon::FILE_UPLOAD && $xPlugin->canProcessRequest()) |
|
| 374 | + if ($xPlugin->getName() != Jaxon::FILE_UPLOAD && $xPlugin->canProcessRequest()) |
|
| 375 | 375 | { |
| 376 | 376 | $xUploadPlugin = $this->xPluginManager->getRequestPlugin(Jaxon::FILE_UPLOAD); |
| 377 | 377 | // Process uploaded files |
| 378 | - if($xUploadPlugin != null) |
|
| 378 | + if ($xUploadPlugin != null) |
|
| 379 | 379 | { |
| 380 | 380 | $xUploadPlugin->processRequest(); |
| 381 | 381 | } |
@@ -59,8 +59,7 @@ discard block |
||
| 59 | 59 | { |
| 60 | 60 | $this->nMethod = Jaxon::METHOD_POST; |
| 61 | 61 | $this->aArgs = $_POST['jxnargs']; |
| 62 | - } |
|
| 63 | - elseif(isset($_GET['jxnargs'])) |
|
| 62 | + } elseif(isset($_GET['jxnargs'])) |
|
| 64 | 63 | { |
| 65 | 64 | $this->nMethod = Jaxon::METHOD_GET; |
| 66 | 65 | $this->aArgs = $_GET['jxnargs']; |
@@ -169,8 +168,7 @@ discard block |
||
| 169 | 168 | if(key_exists('CONTENT_TYPE', $_SERVER)) |
| 170 | 169 | { |
| 171 | 170 | $sContentType = substr($_SERVER['CONTENT_TYPE'], 0, $iLen); |
| 172 | - } |
|
| 173 | - elseif(key_exists('HTTP_CONTENT_TYPE', $_SERVER)) |
|
| 171 | + } elseif(key_exists('HTTP_CONTENT_TYPE', $_SERVER)) |
|
| 174 | 172 | { |
| 175 | 173 | $sContentType = substr($_SERVER['HTTP_CONTENT_TYPE'], 0, $iLen); |
| 176 | 174 | } |
@@ -184,8 +182,7 @@ discard block |
||
| 184 | 182 | if($data !== null && $sArg != $data) |
| 185 | 183 | { |
| 186 | 184 | $sArg = $data; |
| 187 | - } |
|
| 188 | - else |
|
| 185 | + } else |
|
| 189 | 186 | { |
| 190 | 187 | $sArg = $this->__convertValue($sArg); |
| 191 | 188 | } |
@@ -214,8 +211,7 @@ discard block |
||
| 214 | 211 | } |
| 215 | 212 | $this->__argumentDecodeUTF8_iconv($xArg); |
| 216 | 213 | } |
| 217 | - } |
|
| 218 | - elseif(is_string($mArg)) |
|
| 214 | + } elseif(is_string($mArg)) |
|
| 219 | 215 | { |
| 220 | 216 | $mArg = iconv("UTF-8", $this->getOption('core.encoding') . '//TRANSLIT', $mArg); |
| 221 | 217 | } |
@@ -244,8 +240,7 @@ discard block |
||
| 244 | 240 | } |
| 245 | 241 | $this->__argumentDecodeUTF8_mb_convert_encoding($xArg); |
| 246 | 242 | } |
| 247 | - } |
|
| 248 | - elseif(is_string($mArg)) |
|
| 243 | + } elseif(is_string($mArg)) |
|
| 249 | 244 | { |
| 250 | 245 | $mArg = mb_convert_encoding($mArg, $this->getOption('core.encoding'), "UTF-8"); |
| 251 | 246 | } |
@@ -276,8 +271,7 @@ discard block |
||
| 276 | 271 | |
| 277 | 272 | $this->__argumentDecodeUTF8_utf8_decode($xArg); |
| 278 | 273 | } |
| 279 | - } |
|
| 280 | - elseif(is_string($mArg)) |
|
| 274 | + } elseif(is_string($mArg)) |
|
| 281 | 275 | { |
| 282 | 276 | $mArg = utf8_decode($mArg); |
| 283 | 277 | } |
@@ -309,16 +303,13 @@ discard block |
||
| 309 | 303 | if(function_exists('iconv')) |
| 310 | 304 | { |
| 311 | 305 | $sFunction = "iconv"; |
| 312 | - } |
|
| 313 | - elseif(function_exists('mb_convert_encoding')) |
|
| 306 | + } elseif(function_exists('mb_convert_encoding')) |
|
| 314 | 307 | { |
| 315 | 308 | $sFunction = "mb_convert_encoding"; |
| 316 | - } |
|
| 317 | - elseif($this->getOption('core.encoding') == "ISO-8859-1") |
|
| 309 | + } elseif($this->getOption('core.encoding') == "ISO-8859-1") |
|
| 318 | 310 | { |
| 319 | 311 | $sFunction = "utf8_decode"; |
| 320 | - } |
|
| 321 | - else |
|
| 312 | + } else |
|
| 322 | 313 | { |
| 323 | 314 | throw new \Jaxon\Exception\Error($this->trans('errors.request.conversion')); |
| 324 | 315 | } |
@@ -23,7 +23,6 @@ |
||
| 23 | 23 | namespace Jaxon\Request; |
| 24 | 24 | |
| 25 | 25 | use Jaxon\Jaxon; |
| 26 | - |
|
| 27 | 26 | use Jaxon\Plugin\Manager as PluginManager; |
| 28 | 27 | |
| 29 | 28 | class Handler |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | 'core.prefix.class' => 'Jaxon', |
| 157 | 157 | // 'core.request.uri' => '', |
| 158 | 158 | 'core.request.mode' => 'asynchronous', |
| 159 | - 'core.request.method' => 'POST', // W3C: Method is case sensitive |
|
| 159 | + 'core.request.method' => 'POST', // W3C: Method is case sensitive |
|
| 160 | 160 | 'core.response.merge.ap' => true, |
| 161 | 161 | 'core.response.merge.js' => true, |
| 162 | 162 | 'core.debug.on' => false, |
@@ -244,17 +244,17 @@ discard block |
||
| 244 | 244 | */ |
| 245 | 245 | public function getScript($bIncludeJs = false, $bIncludeCss = false) |
| 246 | 246 | { |
| 247 | - if(!$this->getOption('core.request.uri')) |
|
| 247 | + if (!$this->getOption('core.request.uri')) |
|
| 248 | 248 | { |
| 249 | 249 | $this->setOption('core.request.uri', URI::detect()); |
| 250 | 250 | } |
| 251 | 251 | $sCode = ''; |
| 252 | 252 | $xCodeGenerator = $this->di()->getCodeGenerator(); |
| 253 | - if(($bIncludeCss)) |
|
| 253 | + if (($bIncludeCss)) |
|
| 254 | 254 | { |
| 255 | 255 | $sCode .= $xCodeGenerator->getCss() . "\n"; |
| 256 | 256 | } |
| 257 | - if(($bIncludeJs)) |
|
| 257 | + if (($bIncludeJs)) |
|
| 258 | 258 | { |
| 259 | 259 | $sCode .= $xCodeGenerator->getJs() . "\n"; |
| 260 | 260 | } |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | public function processRequest() |
| 326 | 326 | { |
| 327 | 327 | // Check to see if headers have already been sent out, in which case we can't do our job |
| 328 | - if(headers_sent($filename, $linenumber)) |
|
| 328 | + if (headers_sent($filename, $linenumber)) |
|
| 329 | 329 | { |
| 330 | 330 | echo $this->trans('errors.output.already-sent', array( |
| 331 | 331 | 'location' => $filename . ':' . $linenumber |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | } |
| 335 | 335 | |
| 336 | 336 | // Check if there is a plugin to process this request |
| 337 | - if(!$this->canProcessRequest()) |
|
| 337 | + if (!$this->canProcessRequest()) |
|
| 338 | 338 | { |
| 339 | 339 | return; |
| 340 | 340 | } |
@@ -344,18 +344,18 @@ discard block |
||
| 344 | 344 | $xResponseManager = $this->getResponseManager(); |
| 345 | 345 | |
| 346 | 346 | // Handle before processing event |
| 347 | - if(isset($this->aProcessingEvents[self::PROCESSING_EVENT_BEFORE])) |
|
| 347 | + if (isset($this->aProcessingEvents[self::PROCESSING_EVENT_BEFORE])) |
|
| 348 | 348 | { |
| 349 | 349 | $this->aProcessingEvents[self::PROCESSING_EVENT_BEFORE]->call(array(&$bEndRequest)); |
| 350 | 350 | } |
| 351 | 351 | |
| 352 | - if(!$bEndRequest) |
|
| 352 | + if (!$bEndRequest) |
|
| 353 | 353 | { |
| 354 | 354 | try |
| 355 | 355 | { |
| 356 | 356 | $mResult = $this->getRequestHandler()->processRequest(); |
| 357 | 357 | } |
| 358 | - catch(Exception $e) |
|
| 358 | + catch (Exception $e) |
|
| 359 | 359 | { |
| 360 | 360 | // An exception was thrown while processing the request. |
| 361 | 361 | // The request missed the corresponding handler function, |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | $xResponseManager->debug($e->getMessage()); |
| 368 | 368 | $mResult = false; |
| 369 | 369 | |
| 370 | - if($e instanceof \Jaxon\Exception\Error) |
|
| 370 | + if ($e instanceof \Jaxon\Exception\Error) |
|
| 371 | 371 | { |
| 372 | 372 | $sEvent = self::PROCESSING_EVENT_INVALID; |
| 373 | 373 | $aParams = array($e->getMessage()); |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | $aParams = array($e); |
| 379 | 379 | } |
| 380 | 380 | |
| 381 | - if(isset($this->aProcessingEvents[$sEvent])) |
|
| 381 | + if (isset($this->aProcessingEvents[$sEvent])) |
|
| 382 | 382 | { |
| 383 | 383 | // Call the processing event |
| 384 | 384 | $this->aProcessingEvents[$sEvent]->call($aParams); |
@@ -391,7 +391,7 @@ discard block |
||
| 391 | 391 | } |
| 392 | 392 | } |
| 393 | 393 | // Clean the processing buffer |
| 394 | - if(($this->getOption('core.process.clean'))) |
|
| 394 | + if (($this->getOption('core.process.clean'))) |
|
| 395 | 395 | { |
| 396 | 396 | $er = error_reporting(0); |
| 397 | 397 | while (ob_get_level() > 0) |
@@ -401,16 +401,16 @@ discard block |
||
| 401 | 401 | error_reporting($er); |
| 402 | 402 | } |
| 403 | 403 | |
| 404 | - if($mResult === true) |
|
| 404 | + if ($mResult === true) |
|
| 405 | 405 | { |
| 406 | 406 | // Handle after processing event |
| 407 | - if(isset($this->aProcessingEvents[self::PROCESSING_EVENT_AFTER])) |
|
| 407 | + if (isset($this->aProcessingEvents[self::PROCESSING_EVENT_AFTER])) |
|
| 408 | 408 | { |
| 409 | 409 | $bEndRequest = false; |
| 410 | 410 | $this->aProcessingEvents[self::PROCESSING_EVENT_AFTER]->call(array($bEndRequest)); |
| 411 | 411 | } |
| 412 | 412 | // If the called function returned no response, give the the global response instead |
| 413 | - if($xResponseManager->hasNoResponse()) |
|
| 413 | + if ($xResponseManager->hasNoResponse()) |
|
| 414 | 414 | { |
| 415 | 415 | $xResponseManager->append($this->getResponse()); |
| 416 | 416 | } |
@@ -418,7 +418,7 @@ discard block |
||
| 418 | 418 | |
| 419 | 419 | $xResponseManager->printDebug(); |
| 420 | 420 | |
| 421 | - if(($this->getOption('core.process.exit'))) |
|
| 421 | + if (($this->getOption('core.process.exit'))) |
|
| 422 | 422 | { |
| 423 | 423 | $xResponseManager->sendOutput(); |
| 424 | 424 | exit(); |
@@ -354,8 +354,7 @@ discard block |
||
| 354 | 354 | try |
| 355 | 355 | { |
| 356 | 356 | $mResult = $this->getRequestHandler()->processRequest(); |
| 357 | - } |
|
| 358 | - catch(Exception $e) |
|
| 357 | + } catch(Exception $e) |
|
| 359 | 358 | { |
| 360 | 359 | // An exception was thrown while processing the request. |
| 361 | 360 | // The request missed the corresponding handler function, |
@@ -371,8 +370,7 @@ discard block |
||
| 371 | 370 | { |
| 372 | 371 | $sEvent = self::PROCESSING_EVENT_INVALID; |
| 373 | 372 | $aParams = array($e->getMessage()); |
| 374 | - } |
|
| 375 | - else |
|
| 373 | + } else |
|
| 376 | 374 | { |
| 377 | 375 | $sEvent = self::PROCESSING_EVENT_ERROR; |
| 378 | 376 | $aParams = array($e); |
@@ -382,8 +380,7 @@ discard block |
||
| 382 | 380 | { |
| 383 | 381 | // Call the processing event |
| 384 | 382 | $this->aProcessingEvents[$sEvent]->call($aParams); |
| 385 | - } |
|
| 386 | - else |
|
| 383 | + } else |
|
| 387 | 384 | { |
| 388 | 385 | // The exception is not to be processed here. |
| 389 | 386 | throw $e; |