@@ -46,7 +46,7 @@ |
||
| 46 | 46 | /** |
| 47 | 47 | * Check uploaded files validity and move them to the user dir |
| 48 | 48 | * |
| 49 | - * @return boolean |
|
| 49 | + * @return null|boolean |
|
| 50 | 50 | */ |
| 51 | 51 | public function saveUploadedFiles() |
| 52 | 52 | { |
@@ -19,11 +19,6 @@ |
||
| 19 | 19 | |
| 20 | 20 | namespace Jaxon\Traits; |
| 21 | 21 | |
| 22 | -use Jaxon\Plugin\Manager as PluginManager; |
|
| 23 | -use Jaxon\Request\Manager as RequestManager; |
|
| 24 | -use Jaxon\Response\Manager as ResponseManager; |
|
| 25 | - |
|
| 26 | -use Jaxon\Utils\URI; |
|
| 27 | 22 | use Exception; |
| 28 | 23 | use Closure; |
| 29 | 24 | |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | trait Upload |
| 31 | 31 | { |
| 32 | - /** |
|
| 32 | + /** |
|
| 33 | 33 | * Check if uploaded files are available |
| 34 | 34 | * |
| 35 | 35 | * @return boolean |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | return $xUploadPlugin->canProcessRequest(); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - /** |
|
| 46 | + /** |
|
| 47 | 47 | * Check uploaded files validity and move them to the user dir |
| 48 | 48 | * |
| 49 | 49 | * @return boolean |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | public function hasUploadedFiles() |
| 38 | 38 | { |
| 39 | - if(($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null) |
|
| 39 | + if (($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null) |
|
| 40 | 40 | { |
| 41 | 41 | return false; |
| 42 | 42 | } |
@@ -52,11 +52,11 @@ discard block |
||
| 52 | 52 | { |
| 53 | 53 | try |
| 54 | 54 | { |
| 55 | - if(($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null) |
|
| 55 | + if (($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null) |
|
| 56 | 56 | { |
| 57 | 57 | throw new Exception($this->trans('errors.upload.plugin')); |
| 58 | 58 | } |
| 59 | - elseif(!$xUploadPlugin->canProcessRequest()) |
|
| 59 | + elseif (!$xUploadPlugin->canProcessRequest()) |
|
| 60 | 60 | { |
| 61 | 61 | throw new Exception($this->trans('errors.upload.request')); |
| 62 | 62 | } |
@@ -65,14 +65,14 @@ discard block |
||
| 65 | 65 | $sResponse = '{"code": "success", "upl": "' . $sKey . '"}'; |
| 66 | 66 | $return = true; |
| 67 | 67 | } |
| 68 | - catch(Exception $e) |
|
| 68 | + catch (Exception $e) |
|
| 69 | 69 | { |
| 70 | 70 | $sResponse = '{"code": "error", "msg": "' . addslashes($e->getMessage()) . '"}'; |
| 71 | 71 | $return = false; |
| 72 | 72 | } |
| 73 | 73 | // Send the response back to the browser |
| 74 | 74 | echo '<script>var res = ', $sResponse, '; </script>'; |
| 75 | - if(($this->getOption('core.process.exit'))) |
|
| 75 | + if (($this->getOption('core.process.exit'))) |
|
| 76 | 76 | { |
| 77 | 77 | exit(); |
| 78 | 78 | } |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | public function getUploadedFiles() |
| 88 | 88 | { |
| 89 | - if(($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null) |
|
| 89 | + if (($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null) |
|
| 90 | 90 | { |
| 91 | 91 | return []; |
| 92 | 92 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | public function setUploadFileFilter(Closure $fFileFilter) |
| 104 | 104 | { |
| 105 | - if(($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null) |
|
| 105 | + if (($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null) |
|
| 106 | 106 | { |
| 107 | 107 | return; |
| 108 | 108 | } |
@@ -55,8 +55,7 @@ discard block |
||
| 55 | 55 | if(($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null) |
| 56 | 56 | { |
| 57 | 57 | throw new Exception($this->trans('errors.upload.plugin')); |
| 58 | - } |
|
| 59 | - elseif(!$xUploadPlugin->canProcessRequest()) |
|
| 58 | + } elseif(!$xUploadPlugin->canProcessRequest()) |
|
| 60 | 59 | { |
| 61 | 60 | throw new Exception($this->trans('errors.upload.request')); |
| 62 | 61 | } |
@@ -64,8 +63,7 @@ discard block |
||
| 64 | 63 | $sKey = $xUploadPlugin->saveUploadedFiles(); |
| 65 | 64 | $sResponse = '{"code": "success", "upl": "' . $sKey . '"}'; |
| 66 | 65 | $return = true; |
| 67 | - } |
|
| 68 | - catch(Exception $e) |
|
| 66 | + } catch(Exception $e) |
|
| 69 | 67 | { |
| 70 | 68 | $sResponse = '{"code": "error", "msg": "' . addslashes($e->getMessage()) . '"}'; |
| 71 | 69 | $return = false; |
@@ -241,7 +241,7 @@ |
||
| 241 | 241 | /** |
| 242 | 242 | * Create a new the config manager |
| 243 | 243 | * |
| 244 | - * @return Jaxon\Utils\Config\Config The config manager |
|
| 244 | + * @return \Jaxon\Utils\Config\Config The config manager |
|
| 245 | 245 | */ |
| 246 | 246 | public function newConfig() |
| 247 | 247 | { |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | public static function getInstance() |
| 32 | 32 | { |
| 33 | - if(!self::$xInstance) |
|
| 33 | + if (!self::$xInstance) |
|
| 34 | 34 | { |
| 35 | 35 | self::$xInstance = new Container(); |
| 36 | 36 | } |
@@ -90,19 +90,19 @@ discard block |
||
| 90 | 90 | * Managers |
| 91 | 91 | */ |
| 92 | 92 | // Plugin Manager |
| 93 | - $this->coreContainer['jaxon.core.plugin_manager'] = function ($c) { |
|
| 93 | + $this->coreContainer['jaxon.core.plugin_manager'] = function($c) { |
|
| 94 | 94 | return new \Jaxon\Plugin\Manager(); |
| 95 | 95 | }; |
| 96 | 96 | // Request Manager |
| 97 | - $this->coreContainer['jaxon.core.request_manager'] = function ($c) { |
|
| 97 | + $this->coreContainer['jaxon.core.request_manager'] = function($c) { |
|
| 98 | 98 | return new \Jaxon\Request\Manager(); |
| 99 | 99 | }; |
| 100 | 100 | // Request Factory |
| 101 | - $this->coreContainer['jaxon.core.request_factory'] = function ($c) { |
|
| 101 | + $this->coreContainer['jaxon.core.request_factory'] = function($c) { |
|
| 102 | 102 | return new \Jaxon\Request\Factory(); |
| 103 | 103 | }; |
| 104 | 104 | // Response Manager |
| 105 | - $this->coreContainer['jaxon.core.response_manager'] = function ($c) { |
|
| 105 | + $this->coreContainer['jaxon.core.response_manager'] = function($c) { |
|
| 106 | 106 | return new \Jaxon\Response\Manager(); |
| 107 | 107 | }; |
| 108 | 108 | |
@@ -110,35 +110,35 @@ discard block |
||
| 110 | 110 | * Services |
| 111 | 111 | */ |
| 112 | 112 | // Config manager |
| 113 | - $this->coreContainer['jaxon.core.config'] = function ($c) { |
|
| 113 | + $this->coreContainer['jaxon.core.config'] = function($c) { |
|
| 114 | 114 | return new \Jaxon\Utils\Config\Config(); |
| 115 | 115 | }; |
| 116 | 116 | // Minifier |
| 117 | - $this->coreContainer['jaxon.core.minifier'] = function ($c) { |
|
| 117 | + $this->coreContainer['jaxon.core.minifier'] = function($c) { |
|
| 118 | 118 | return new \Jaxon\Utils\Template\Minifier(); |
| 119 | 119 | }; |
| 120 | 120 | // Translator |
| 121 | - $this->coreContainer['jaxon.core.translator'] = function ($c) { |
|
| 121 | + $this->coreContainer['jaxon.core.translator'] = function($c) { |
|
| 122 | 122 | return new \Jaxon\Utils\Translation\Translator($c['jaxon.core.translation_dir'], $c['jaxon.core.config']); |
| 123 | 123 | }; |
| 124 | 124 | // Template engine |
| 125 | - $this->coreContainer['jaxon.core.template'] = function ($c) { |
|
| 125 | + $this->coreContainer['jaxon.core.template'] = function($c) { |
|
| 126 | 126 | return new \Jaxon\Utils\Template\Template($c['jaxon.core.template_dir']); |
| 127 | 127 | }; |
| 128 | 128 | // Validator |
| 129 | - $this->coreContainer['jaxon.core.validator'] = function ($c) { |
|
| 129 | + $this->coreContainer['jaxon.core.validator'] = function($c) { |
|
| 130 | 130 | return new \Jaxon\Utils\Validation\Validator($c['jaxon.core.translator'], $c['jaxon.core.config']); |
| 131 | 131 | }; |
| 132 | 132 | // Pagination Renderer |
| 133 | - $this->coreContainer['jaxon.pagination.renderer'] = function ($c) { |
|
| 133 | + $this->coreContainer['jaxon.pagination.renderer'] = function($c) { |
|
| 134 | 134 | return new \Jaxon\Utils\Pagination\Renderer(); |
| 135 | 135 | }; |
| 136 | 136 | // Pagination Paginator |
| 137 | - $this->coreContainer['jaxon.pagination.paginator'] = function ($c) { |
|
| 137 | + $this->coreContainer['jaxon.pagination.paginator'] = function($c) { |
|
| 138 | 138 | return new \Jaxon\Utils\Pagination\Paginator($c['jaxon.pagination.renderer']); |
| 139 | 139 | }; |
| 140 | 140 | // Event Dispatcher |
| 141 | - $this->coreContainer['jaxon.core.events'] = function ($c) { |
|
| 141 | + $this->coreContainer['jaxon.core.events'] = function($c) { |
|
| 142 | 142 | return new EventDispatcher(); |
| 143 | 143 | }; |
| 144 | 144 | |
@@ -146,15 +146,15 @@ discard block |
||
| 146 | 146 | * Core library objects |
| 147 | 147 | */ |
| 148 | 148 | // Global Response |
| 149 | - $this->coreContainer['jaxon.core.response'] = function ($c) { |
|
| 149 | + $this->coreContainer['jaxon.core.response'] = function($c) { |
|
| 150 | 150 | return new \Jaxon\Response\Response(); |
| 151 | 151 | }; |
| 152 | 152 | // Jaxon Core |
| 153 | - $this->coreContainer['jaxon.core.jaxon'] = function ($c) { |
|
| 153 | + $this->coreContainer['jaxon.core.jaxon'] = function($c) { |
|
| 154 | 154 | return new \Jaxon\Jaxon(); |
| 155 | 155 | }; |
| 156 | 156 | // View Renderer Facade |
| 157 | - $this->coreContainer['jaxon.sentry.view.renderer'] = function ($c) { |
|
| 157 | + $this->coreContainer['jaxon.sentry.view.renderer'] = function($c) { |
|
| 158 | 158 | $aRenderers = $c['jaxon.view.data.renderers']; |
| 159 | 159 | $sDefaultNamespace = $c['jaxon.view.data.namespace.default']; |
| 160 | 160 | return new \Jaxon\Sentry\View\Facade($aRenderers, $sDefaultNamespace); |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | */ |
| 169 | 169 | public function get($sClass) |
| 170 | 170 | { |
| 171 | - if($this->sentryContainer != null && $this->sentryContainer->has($sClass)) |
|
| 171 | + if ($this->sentryContainer != null && $this->sentryContainer->has($sClass)) |
|
| 172 | 172 | { |
| 173 | 173 | return $this->sentryContainer->get($sClass); |
| 174 | 174 | } |
@@ -443,14 +443,14 @@ discard block |
||
| 443 | 443 | $this->coreContainer['jaxon.sentry.view.base.' . $sId] = $xClosure; |
| 444 | 444 | |
| 445 | 445 | // Return the initialized view renderer |
| 446 | - $this->coreContainer['jaxon.sentry.view.' . $sId] = function ($c) use ($sId) { |
|
| 446 | + $this->coreContainer['jaxon.sentry.view.' . $sId] = function($c) use ($sId) { |
|
| 447 | 447 | // Get the defined renderer |
| 448 | 448 | $renderer = $c['jaxon.sentry.view.base.' . $sId]; |
| 449 | 449 | // Init the renderer with the template namespaces |
| 450 | 450 | $aNamespaces = $this->coreContainer['jaxon.view.data.namespaces']; |
| 451 | - if(key_exists($sId, $aNamespaces)) |
|
| 451 | + if (key_exists($sId, $aNamespaces)) |
|
| 452 | 452 | { |
| 453 | - foreach($aNamespaces[$sId] as $ns) |
|
| 453 | + foreach ($aNamespaces[$sId] as $ns) |
|
| 454 | 454 | { |
| 455 | 455 | $renderer->addNamespace($ns['namespace'], $ns['directory'], $ns['extension']); |
| 456 | 456 | } |
@@ -468,7 +468,7 @@ discard block |
||
| 468 | 468 | */ |
| 469 | 469 | public function getViewRenderer($sId = '') |
| 470 | 470 | { |
| 471 | - if(!$sId) |
|
| 471 | + if (!$sId) |
|
| 472 | 472 | { |
| 473 | 473 | // Return the view renderer facade |
| 474 | 474 | return $this->coreContainer['jaxon.sentry.view.renderer']; |
@@ -19,8 +19,6 @@ |
||
| 19 | 19 | |
| 20 | 20 | namespace Jaxon\Traits; |
| 21 | 21 | |
| 22 | -use Jaxon\DI\Container; |
|
| 23 | - |
|
| 24 | 22 | trait Autoload |
| 25 | 23 | { |
| 26 | 24 | /** |
@@ -54,11 +54,11 @@ discard block |
||
| 54 | 54 | $this->aCalls = array(); |
| 55 | 55 | |
| 56 | 56 | $jQueryNs = jaxon()->getOption('core.jquery.no_conflict', false) ? 'jQuery' : '$'; |
| 57 | - if(!$sSelector) |
|
| 57 | + if (!$sSelector) |
|
| 58 | 58 | { |
| 59 | 59 | $this->sSelector = "$jQueryNs(this)"; // If an empty selector is given, use javascript "this" instead |
| 60 | 60 | } |
| 61 | - elseif(($sContext)) |
|
| 61 | + elseif (($sContext)) |
|
| 62 | 62 | { |
| 63 | 63 | $this->sSelector = "$jQueryNs('" . $sSelector . "', $jQueryNs('" . $sContext . "'))"; |
| 64 | 64 | } |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | */ |
| 115 | 115 | public function getScript() |
| 116 | 116 | { |
| 117 | - if(count($this->aCalls) == 0) |
|
| 117 | + if (count($this->aCalls) == 0) |
|
| 118 | 118 | { |
| 119 | 119 | return $this->sSelector; |
| 120 | 120 | } |
@@ -57,12 +57,10 @@ |
||
| 57 | 57 | if(!$sSelector) |
| 58 | 58 | { |
| 59 | 59 | $this->sSelector = "$jQueryNs(this)"; // If an empty selector is given, use javascript "this" instead |
| 60 | - } |
|
| 61 | - elseif(($sContext)) |
|
| 60 | + } elseif(($sContext)) |
|
| 62 | 61 | { |
| 63 | 62 | $this->sSelector = "$jQueryNs('" . $sSelector . "', $jQueryNs('" . $sContext . "'))"; |
| 64 | - } |
|
| 65 | - else |
|
| 63 | + } else |
|
| 66 | 64 | { |
| 67 | 65 | $this->sSelector = "$jQueryNs('" . $sSelector . "')"; |
| 68 | 66 | } |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | */ |
| 94 | 94 | public function __construct($xCallable) |
| 95 | 95 | { |
| 96 | - if(is_string($xCallable)) // Received a class name |
|
| 96 | + if (is_string($xCallable)) // Received a class name |
|
| 97 | 97 | { |
| 98 | 98 | $this->reflectionClass = new \ReflectionClass($xCallable); |
| 99 | 99 | $this->callableObject = null; |
@@ -119,14 +119,14 @@ discard block |
||
| 119 | 119 | */ |
| 120 | 120 | private function setCallable($xCallable = null) |
| 121 | 121 | { |
| 122 | - if($xCallable == null) |
|
| 122 | + if ($xCallable == null) |
|
| 123 | 123 | { |
| 124 | 124 | // Use the Reflection class to get the parameters of the constructor |
| 125 | - if(($constructor = $this->reflectionClass->getConstructor()) != null) |
|
| 125 | + if (($constructor = $this->reflectionClass->getConstructor()) != null) |
|
| 126 | 126 | { |
| 127 | 127 | $parameters = $constructor->getParameters(); |
| 128 | 128 | $parameterInstances = []; |
| 129 | - foreach($parameters as $parameter) |
|
| 129 | + foreach ($parameters as $parameter) |
|
| 130 | 130 | { |
| 131 | 131 | // Get the parameter instance from the DI |
| 132 | 132 | $parameterInstances[] = $this->diGet($parameter->getClass()->getName()); |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | } |
| 140 | 140 | } |
| 141 | 141 | // Save the Jaxon callable object into the user callable object |
| 142 | - if($this->reflectionClass->hasMethod('setJaxonCallable')) |
|
| 142 | + if ($this->reflectionClass->hasMethod('setJaxonCallable')) |
|
| 143 | 143 | { |
| 144 | 144 | $xCallable->setJaxonCallable($this); |
| 145 | 145 | } |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | */ |
| 154 | 154 | public function getRegisteredObject() |
| 155 | 155 | { |
| 156 | - if($this->callableObject == null) |
|
| 156 | + if ($this->callableObject == null) |
|
| 157 | 157 | { |
| 158 | 158 | $this->setCallable(); |
| 159 | 159 | } |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | // The class name without the namespace. |
| 182 | 182 | $name = $this->reflectionClass->getShortName(); |
| 183 | 183 | // Append the classpath to the name |
| 184 | - if(($this->classpath)) |
|
| 184 | + if (($this->classpath)) |
|
| 185 | 185 | { |
| 186 | 186 | $name = $this->classpath . '\\' . $name; |
| 187 | 187 | } |
@@ -228,16 +228,16 @@ discard block |
||
| 228 | 228 | public function getMethods() |
| 229 | 229 | { |
| 230 | 230 | $aReturn = []; |
| 231 | - foreach($this->reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $xMethod) |
|
| 231 | + foreach ($this->reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $xMethod) |
|
| 232 | 232 | { |
| 233 | 233 | $sMethodName = $xMethod->getShortName(); |
| 234 | 234 | // Don't take magic __call, __construct, __destruct methods |
| 235 | - if(strlen($sMethodName) > 2 && substr($sMethodName, 0, 2) == '__') |
|
| 235 | + if (strlen($sMethodName) > 2 && substr($sMethodName, 0, 2) == '__') |
|
| 236 | 236 | { |
| 237 | 237 | continue; |
| 238 | 238 | } |
| 239 | 239 | // Don't take excluded methods |
| 240 | - if(in_array($sMethodName, $this->aProtectedMethods)) |
|
| 240 | + if (in_array($sMethodName, $this->aProtectedMethods)) |
|
| 241 | 241 | { |
| 242 | 242 | continue; |
| 243 | 243 | } |
@@ -258,37 +258,37 @@ discard block |
||
| 258 | 258 | public function configure($sMethod, $sName, $sValue) |
| 259 | 259 | { |
| 260 | 260 | // Set the namespace |
| 261 | - if($sName == 'namespace') |
|
| 261 | + if ($sName == 'namespace') |
|
| 262 | 262 | { |
| 263 | - if($sValue != '') |
|
| 263 | + if ($sValue != '') |
|
| 264 | 264 | $this->namespace = $sValue; |
| 265 | 265 | return; |
| 266 | 266 | } |
| 267 | 267 | // Set the classpath |
| 268 | - if($sName == 'classpath') |
|
| 268 | + if ($sName == 'classpath') |
|
| 269 | 269 | { |
| 270 | - if($sValue != '') |
|
| 270 | + if ($sValue != '') |
|
| 271 | 271 | $this->classpath = trim($sValue, '\\'); |
| 272 | 272 | return; |
| 273 | 273 | } |
| 274 | 274 | // Set the separator |
| 275 | - if($sName == 'separator') |
|
| 275 | + if ($sName == 'separator') |
|
| 276 | 276 | { |
| 277 | - if($sValue == '_' || $sValue == '.') |
|
| 277 | + if ($sValue == '_' || $sValue == '.') |
|
| 278 | 278 | $this->separator = $sValue; |
| 279 | 279 | return; |
| 280 | 280 | } |
| 281 | 281 | // Set the excluded methods |
| 282 | - if($sName == 'protected') |
|
| 282 | + if ($sName == 'protected') |
|
| 283 | 283 | { |
| 284 | - if(is_array($sValue)) |
|
| 284 | + if (is_array($sValue)) |
|
| 285 | 285 | $this->aProtectedMethods = array_merge($this->aProtectedMethods, $sValue); |
| 286 | - elseif(is_string($sValue)) |
|
| 286 | + elseif (is_string($sValue)) |
|
| 287 | 287 | $this->aProtectedMethods[] = $sValue; |
| 288 | 288 | return; |
| 289 | 289 | } |
| 290 | 290 | |
| 291 | - if(!isset($this->aConfiguration[$sMethod])) |
|
| 291 | + if (!isset($this->aConfiguration[$sMethod])) |
|
| 292 | 292 | { |
| 293 | 293 | $this->aConfiguration[$sMethod] = []; |
| 294 | 294 | } |
@@ -309,16 +309,16 @@ discard block |
||
| 309 | 309 | |
| 310 | 310 | // Common options to be set on all methods |
| 311 | 311 | $aCommonConfig = array_key_exists('*', $this->aConfiguration) ? $this->aConfiguration['*'] : []; |
| 312 | - foreach($this->reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $xMethod) |
|
| 312 | + foreach ($this->reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $xMethod) |
|
| 313 | 313 | { |
| 314 | 314 | $sMethodName = $xMethod->getShortName(); |
| 315 | 315 | // Don't export magic __call, __construct, __destruct methods |
| 316 | - if(strlen($sMethodName) > 0 && substr($sMethodName, 0, 2) == '__') |
|
| 316 | + if (strlen($sMethodName) > 0 && substr($sMethodName, 0, 2) == '__') |
|
| 317 | 317 | { |
| 318 | 318 | continue; |
| 319 | 319 | } |
| 320 | 320 | // Don't export "protected" methods |
| 321 | - if(in_array($sMethodName, $this->aProtectedMethods)) |
|
| 321 | + if (in_array($sMethodName, $this->aProtectedMethods)) |
|
| 322 | 322 | { |
| 323 | 323 | continue; |
| 324 | 324 | } |
@@ -368,14 +368,14 @@ discard block |
||
| 368 | 368 | */ |
| 369 | 369 | public function call($sMethod, $aArgs) |
| 370 | 370 | { |
| 371 | - if(!$this->hasMethod($sMethod)) |
|
| 371 | + if (!$this->hasMethod($sMethod)) |
|
| 372 | 372 | { |
| 373 | 373 | return; |
| 374 | 374 | } |
| 375 | 375 | $reflectionMethod = $this->reflectionClass->getMethod($sMethod); |
| 376 | 376 | $callableObject = $this->getRegisteredObject(); |
| 377 | 377 | $response = $reflectionMethod->invokeArgs($callableObject, $aArgs); |
| 378 | - if(($response)) |
|
| 378 | + if (($response)) |
|
| 379 | 379 | { |
| 380 | 380 | $this->getResponseManager()->append($response); |
| 381 | 381 | } |
@@ -93,12 +93,13 @@ discard block |
||
| 93 | 93 | */ |
| 94 | 94 | public function __construct($xCallable) |
| 95 | 95 | { |
| 96 | - if(is_string($xCallable)) // Received a class name |
|
| 96 | + if(is_string($xCallable)) { |
|
| 97 | + // Received a class name |
|
| 97 | 98 | { |
| 98 | 99 | $this->reflectionClass = new \ReflectionClass($xCallable); |
| 99 | - $this->callableObject = null; |
|
| 100 | 100 | } |
| 101 | - else // if(is_object($xCallable)) // Received a class instance |
|
| 101 | + $this->callableObject = null; |
|
| 102 | + } else // if(is_object($xCallable)) // Received a class instance |
|
| 102 | 103 | { |
| 103 | 104 | $this->reflectionClass = new \ReflectionClass(get_class($xCallable)); |
| 104 | 105 | $this->setCallable($xCallable); |
@@ -132,8 +133,7 @@ discard block |
||
| 132 | 133 | $parameterInstances[] = $this->diGet($parameter->getClass()->getName()); |
| 133 | 134 | } |
| 134 | 135 | $xCallable = $this->reflectionClass->newInstanceArgs($parameterInstances); |
| 135 | - } |
|
| 136 | - else |
|
| 136 | + } else |
|
| 137 | 137 | { |
| 138 | 138 | $xCallable = $this->reflectionClass->newInstance(); |
| 139 | 139 | } |
@@ -260,31 +260,35 @@ discard block |
||
| 260 | 260 | // Set the namespace |
| 261 | 261 | if($sName == 'namespace') |
| 262 | 262 | { |
| 263 | - if($sValue != '') |
|
| 264 | - $this->namespace = $sValue; |
|
| 263 | + if($sValue != '') { |
|
| 264 | + $this->namespace = $sValue; |
|
| 265 | + } |
|
| 265 | 266 | return; |
| 266 | 267 | } |
| 267 | 268 | // Set the classpath |
| 268 | 269 | if($sName == 'classpath') |
| 269 | 270 | { |
| 270 | - if($sValue != '') |
|
| 271 | - $this->classpath = trim($sValue, '\\'); |
|
| 271 | + if($sValue != '') { |
|
| 272 | + $this->classpath = trim($sValue, '\\'); |
|
| 273 | + } |
|
| 272 | 274 | return; |
| 273 | 275 | } |
| 274 | 276 | // Set the separator |
| 275 | 277 | if($sName == 'separator') |
| 276 | 278 | { |
| 277 | - if($sValue == '_' || $sValue == '.') |
|
| 278 | - $this->separator = $sValue; |
|
| 279 | + if($sValue == '_' || $sValue == '.') { |
|
| 280 | + $this->separator = $sValue; |
|
| 281 | + } |
|
| 279 | 282 | return; |
| 280 | 283 | } |
| 281 | 284 | // Set the excluded methods |
| 282 | 285 | if($sName == 'protected') |
| 283 | 286 | { |
| 284 | - if(is_array($sValue)) |
|
| 285 | - $this->aProtectedMethods = array_merge($this->aProtectedMethods, $sValue); |
|
| 286 | - elseif(is_string($sValue)) |
|
| 287 | - $this->aProtectedMethods[] = $sValue; |
|
| 287 | + if(is_array($sValue)) { |
|
| 288 | + $this->aProtectedMethods = array_merge($this->aProtectedMethods, $sValue); |
|
| 289 | + } elseif(is_string($sValue)) { |
|
| 290 | + $this->aProtectedMethods[] = $sValue; |
|
| 291 | + } |
|
| 288 | 292 | return; |
| 289 | 293 | } |
| 290 | 294 | |