@@ -201,7 +201,7 @@ |
||
| 201 | 201 | /** |
| 202 | 202 | * Create a new the config manager |
| 203 | 203 | * |
| 204 | - * @return Jaxon\Utils\Config\Config The config manager |
|
| 204 | + * @return Config\Config The config manager |
|
| 205 | 205 | */ |
| 206 | 206 | public function newConfig() |
| 207 | 207 | { |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | public static function getInstance() |
| 29 | 29 | { |
| 30 | - if(!self::$xInstance) |
|
| 30 | + if (!self::$xInstance) |
|
| 31 | 31 | { |
| 32 | 32 | self::$xInstance = new Container(); |
| 33 | 33 | } |
@@ -65,19 +65,19 @@ discard block |
||
| 65 | 65 | * Managers |
| 66 | 66 | */ |
| 67 | 67 | // Plugin Manager |
| 68 | - $this->di['plugin_manager'] = function ($c) { |
|
| 68 | + $this->di['plugin_manager'] = function($c) { |
|
| 69 | 69 | return new \Jaxon\Plugin\Manager(); |
| 70 | 70 | }; |
| 71 | 71 | // Request Manager |
| 72 | - $this->di['request_manager'] = function ($c) { |
|
| 72 | + $this->di['request_manager'] = function($c) { |
|
| 73 | 73 | return new \Jaxon\Request\Manager(); |
| 74 | 74 | }; |
| 75 | 75 | // Request Factory |
| 76 | - $this->di['request_factory'] = function ($c) { |
|
| 76 | + $this->di['request_factory'] = function($c) { |
|
| 77 | 77 | return new \Jaxon\Request\Factory(); |
| 78 | 78 | }; |
| 79 | 79 | // Response Manager |
| 80 | - $this->di['response_manager'] = function ($c) { |
|
| 80 | + $this->di['response_manager'] = function($c) { |
|
| 81 | 81 | return new \Jaxon\Response\Manager(); |
| 82 | 82 | }; |
| 83 | 83 | |
@@ -85,35 +85,35 @@ discard block |
||
| 85 | 85 | * Services |
| 86 | 86 | */ |
| 87 | 87 | // Config manager |
| 88 | - $this->di['config'] = function ($c) { |
|
| 88 | + $this->di['config'] = function($c) { |
|
| 89 | 89 | return new Config\Config(); |
| 90 | 90 | }; |
| 91 | 91 | // Minifier |
| 92 | - $this->di['minifier'] = function ($c) { |
|
| 92 | + $this->di['minifier'] = function($c) { |
|
| 93 | 93 | return new Template\Minifier(); |
| 94 | 94 | }; |
| 95 | 95 | // Translator |
| 96 | - $this->di['translator'] = function ($c) { |
|
| 96 | + $this->di['translator'] = function($c) { |
|
| 97 | 97 | return new Translation\Translator($c['translation_dir'], $c['config']); |
| 98 | 98 | }; |
| 99 | 99 | // Template engine |
| 100 | - $this->di['template'] = function ($c) { |
|
| 100 | + $this->di['template'] = function($c) { |
|
| 101 | 101 | return new Template\Template($c['template_dir']); |
| 102 | 102 | }; |
| 103 | 103 | // Validator |
| 104 | - $this->di['validator'] = function ($c) { |
|
| 104 | + $this->di['validator'] = function($c) { |
|
| 105 | 105 | return new Validation\Validator($c['translator'], $c['config']); |
| 106 | 106 | }; |
| 107 | 107 | // Pagination Renderer |
| 108 | - $this->di['pagination.renderer'] = function ($c) { |
|
| 108 | + $this->di['pagination.renderer'] = function($c) { |
|
| 109 | 109 | return new Pagination\Renderer(); |
| 110 | 110 | }; |
| 111 | 111 | // Pagination Paginator |
| 112 | - $this->di['pagination.paginator'] = function ($c) { |
|
| 112 | + $this->di['pagination.paginator'] = function($c) { |
|
| 113 | 113 | return new Pagination\Paginator($c['pagination.renderer']); |
| 114 | 114 | }; |
| 115 | 115 | // Event Dispatcher |
| 116 | - $this->di['events'] = function ($c) { |
|
| 116 | + $this->di['events'] = function($c) { |
|
| 117 | 117 | return new EventDispatcher(); |
| 118 | 118 | }; |
| 119 | 119 | |
@@ -121,15 +121,15 @@ discard block |
||
| 121 | 121 | * Core library objects |
| 122 | 122 | */ |
| 123 | 123 | // Global Response |
| 124 | - $this->di['response'] = function ($c) { |
|
| 124 | + $this->di['response'] = function($c) { |
|
| 125 | 125 | return new \Jaxon\Response\Response(); |
| 126 | 126 | }; |
| 127 | 127 | // Jaxon Core |
| 128 | - $this->di['jaxon'] = function ($c) { |
|
| 128 | + $this->di['jaxon'] = function($c) { |
|
| 129 | 129 | return new \Jaxon\Jaxon(); |
| 130 | 130 | }; |
| 131 | 131 | // View Renderer Facade |
| 132 | - $this->di['sentry.view.renderer'] = function ($c) { |
|
| 132 | + $this->di['sentry.view.renderer'] = function($c) { |
|
| 133 | 133 | $aRenderers = $c['view.data.renderers']; |
| 134 | 134 | $sDefaultNamespace = $c['view.data.namespace.default']; |
| 135 | 135 | return new \Jaxon\Sentry\View\Facade($aRenderers, $sDefaultNamespace); |
@@ -391,14 +391,14 @@ discard block |
||
| 391 | 391 | $this->di['sentry.view.base.' . $sId] = $xClosure; |
| 392 | 392 | |
| 393 | 393 | // Return the initialized view renderer |
| 394 | - $this->di['sentry.view.' . $sId] = function ($c) use ($sId) { |
|
| 394 | + $this->di['sentry.view.' . $sId] = function($c) use ($sId) { |
|
| 395 | 395 | // Get the defined renderer |
| 396 | 396 | $renderer = $c['sentry.view.base.' . $sId]; |
| 397 | 397 | // Init the renderer with the template namespaces |
| 398 | 398 | $aNamespaces = $this->di['view.data.namespaces']; |
| 399 | - if(key_exists($sId, $aNamespaces)) |
|
| 399 | + if (key_exists($sId, $aNamespaces)) |
|
| 400 | 400 | { |
| 401 | - foreach($aNamespaces[$sId] as $ns) |
|
| 401 | + foreach ($aNamespaces[$sId] as $ns) |
|
| 402 | 402 | { |
| 403 | 403 | $renderer->addNamespace($ns['namespace'], $ns['directory'], $ns['extension']); |
| 404 | 404 | } |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | */ |
| 417 | 417 | public function getViewRenderer($sId = '') |
| 418 | 418 | { |
| 419 | - if(!$sId) |
|
| 419 | + if (!$sId) |
|
| 420 | 420 | { |
| 421 | 421 | // Return the view renderer facade |
| 422 | 422 | return $this->di['sentry.view.renderer']; |
@@ -212,8 +212,9 @@ discard block |
||
| 212 | 212 | { |
| 213 | 213 | $sEvent = $xArgs; |
| 214 | 214 | $xUserFunction = $aArgs[2]; |
| 215 | - if(!is_a($xUserFunction, 'Request\\Support\\UserFunction')) |
|
| 216 | - $xUserFunction = new Request\Support\UserFunction($xUserFunction); |
|
| 215 | + if(!is_a($xUserFunction, 'Request\\Support\\UserFunction')) { |
|
| 216 | + $xUserFunction = new Request\Support\UserFunction($xUserFunction); |
|
| 217 | + } |
|
| 217 | 218 | $this->aProcessingEvents[$sEvent] = $xUserFunction; |
| 218 | 219 | } |
| 219 | 220 | /*else |
@@ -326,8 +327,7 @@ discard block |
||
| 326 | 327 | try |
| 327 | 328 | { |
| 328 | 329 | $mResult = $this->getPluginManager()->processRequest(); |
| 329 | - } |
|
| 330 | - catch(Exception $e) |
|
| 330 | + } catch(Exception $e) |
|
| 331 | 331 | { |
| 332 | 332 | // An exception was thrown while processing the request. |
| 333 | 333 | // The request missed the corresponding handler function, |
@@ -344,8 +344,7 @@ discard block |
||
| 344 | 344 | { |
| 345 | 345 | $sEvent = self::PROCESSING_EVENT_INVALID; |
| 346 | 346 | $aParams = array($e->getMessage()); |
| 347 | - } |
|
| 348 | - else |
|
| 347 | + } else |
|
| 349 | 348 | { |
| 350 | 349 | $sEvent = self::PROCESSING_EVENT_ERROR; |
| 351 | 350 | $aParams = array($e); |
@@ -355,8 +354,7 @@ discard block |
||
| 355 | 354 | { |
| 356 | 355 | // Call the processing event |
| 357 | 356 | $this->aProcessingEvents[$sEvent]->call($aParams); |
| 358 | - } |
|
| 359 | - else |
|
| 357 | + } else |
|
| 360 | 358 | { |
| 361 | 359 | // The exception is not to be processed here. |
| 362 | 360 | throw $e; |
@@ -141,15 +141,6 @@ |
||
| 141 | 141 | * - Jaxon::CALLABLE_OBJECT: an object who's methods are to be registered |
| 142 | 142 | * - Jaxon::BROWSER_EVENT: an event which will cause zero or more event handlers to be called |
| 143 | 143 | * - Jaxon::EVENT_HANDLER: register an event handler function. |
| 144 | - * @param mixed $sFunction | $objObject | $sEvent |
|
| 145 | - * When registering a function, this is the name of the function |
|
| 146 | - * When registering a callable object, this is the object being registered |
|
| 147 | - * When registering an event or event handler, this is the name of the event |
|
| 148 | - * @param mixed $sIncludeFile | $aCallOptions | $sEventHandler |
|
| 149 | - * When registering a function, this is the (optional) include file |
|
| 150 | - * When registering a callable object, this is an (optional) array |
|
| 151 | - * of call options for the functions being registered |
|
| 152 | - * When registering an event handler, this is the name of the function |
|
| 153 | 144 | * |
| 154 | 145 | * @return mixed |
| 155 | 146 | */ |
@@ -158,13 +158,13 @@ discard block |
||
| 158 | 158 | $aArgs = func_get_args(); |
| 159 | 159 | $nArgs = func_num_args(); |
| 160 | 160 | |
| 161 | - if(self::PROCESSING_EVENT == $sType) |
|
| 161 | + if (self::PROCESSING_EVENT == $sType) |
|
| 162 | 162 | { |
| 163 | - if($nArgs > 2) |
|
| 163 | + if ($nArgs > 2) |
|
| 164 | 164 | { |
| 165 | 165 | $sEvent = $xArgs; |
| 166 | 166 | $xUserFunction = $aArgs[2]; |
| 167 | - if(!is_a($xUserFunction, 'Request\\Support\\UserFunction')) |
|
| 167 | + if (!is_a($xUserFunction, 'Request\\Support\\UserFunction')) |
|
| 168 | 168 | $xUserFunction = new Request\Support\UserFunction($xUserFunction); |
| 169 | 169 | $this->aProcessingEvents[$sEvent] = $xUserFunction; |
| 170 | 170 | } |
@@ -236,16 +236,16 @@ discard block |
||
| 236 | 236 | */ |
| 237 | 237 | public function getScript($bIncludeJs = false, $bIncludeCss = false) |
| 238 | 238 | { |
| 239 | - if(!$this->getOption('core.request.uri')) |
|
| 239 | + if (!$this->getOption('core.request.uri')) |
|
| 240 | 240 | { |
| 241 | 241 | $this->setOption('core.request.uri', URI::detect()); |
| 242 | 242 | } |
| 243 | 243 | $sCode = ''; |
| 244 | - if(($bIncludeCss)) |
|
| 244 | + if (($bIncludeCss)) |
|
| 245 | 245 | { |
| 246 | 246 | $sCode .= $this->getPluginManager()->getCss() . "\n"; |
| 247 | 247 | } |
| 248 | - if(($bIncludeJs)) |
|
| 248 | + if (($bIncludeJs)) |
|
| 249 | 249 | { |
| 250 | 250 | $sCode .= $this->getPluginManager()->getJs() . "\n"; |
| 251 | 251 | } |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | public function processRequest() |
| 317 | 317 | { |
| 318 | 318 | // Check to see if headers have already been sent out, in which case we can't do our job |
| 319 | - if(headers_sent($filename, $linenumber)) |
|
| 319 | + if (headers_sent($filename, $linenumber)) |
|
| 320 | 320 | { |
| 321 | 321 | echo $this->trans('errors.output.already-sent', array( |
| 322 | 322 | 'location' => $filename . ':' . $linenumber |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | // Check if there is a plugin to process this request |
| 328 | - if(!$this->canProcessRequest()) |
|
| 328 | + if (!$this->canProcessRequest()) |
|
| 329 | 329 | { |
| 330 | 330 | return; |
| 331 | 331 | } |
@@ -334,18 +334,18 @@ discard block |
||
| 334 | 334 | $mResult = true; |
| 335 | 335 | |
| 336 | 336 | // Handle before processing event |
| 337 | - if(isset($this->aProcessingEvents[self::PROCESSING_EVENT_BEFORE])) |
|
| 337 | + if (isset($this->aProcessingEvents[self::PROCESSING_EVENT_BEFORE])) |
|
| 338 | 338 | { |
| 339 | 339 | $this->aProcessingEvents[self::PROCESSING_EVENT_BEFORE]->call(array(&$bEndRequest)); |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | - if(!$bEndRequest) |
|
| 342 | + if (!$bEndRequest) |
|
| 343 | 343 | { |
| 344 | 344 | try |
| 345 | 345 | { |
| 346 | 346 | $mResult = $this->getPluginManager()->processRequest(); |
| 347 | 347 | } |
| 348 | - catch(Exception $e) |
|
| 348 | + catch (Exception $e) |
|
| 349 | 349 | { |
| 350 | 350 | // An exception was thrown while processing the request. |
| 351 | 351 | // The request missed the corresponding handler function, |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | $xResponseManager->debug($e->getMessage()); |
| 359 | 359 | $mResult = false; |
| 360 | 360 | |
| 361 | - if($e instanceof \Jaxon\Exception\Error) |
|
| 361 | + if ($e instanceof \Jaxon\Exception\Error) |
|
| 362 | 362 | { |
| 363 | 363 | $sEvent = self::PROCESSING_EVENT_INVALID; |
| 364 | 364 | $aParams = array($e->getMessage()); |
@@ -369,7 +369,7 @@ discard block |
||
| 369 | 369 | $aParams = array($e); |
| 370 | 370 | } |
| 371 | 371 | |
| 372 | - if(isset($this->aProcessingEvents[$sEvent])) |
|
| 372 | + if (isset($this->aProcessingEvents[$sEvent])) |
|
| 373 | 373 | { |
| 374 | 374 | // Call the processing event |
| 375 | 375 | $this->aProcessingEvents[$sEvent]->call($aParams); |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | } |
| 383 | 383 | } |
| 384 | 384 | // Clean the processing buffer |
| 385 | - if(($this->getOption('core.process.clean'))) |
|
| 385 | + if (($this->getOption('core.process.clean'))) |
|
| 386 | 386 | { |
| 387 | 387 | $er = error_reporting(0); |
| 388 | 388 | while (ob_get_level() > 0) |
@@ -392,10 +392,10 @@ discard block |
||
| 392 | 392 | error_reporting($er); |
| 393 | 393 | } |
| 394 | 394 | |
| 395 | - if($mResult === true) |
|
| 395 | + if ($mResult === true) |
|
| 396 | 396 | { |
| 397 | 397 | // Handle after processing event |
| 398 | - if(isset($this->aProcessingEvents[self::PROCESSING_EVENT_AFTER])) |
|
| 398 | + if (isset($this->aProcessingEvents[self::PROCESSING_EVENT_AFTER])) |
|
| 399 | 399 | { |
| 400 | 400 | $bEndRequest = false; |
| 401 | 401 | $this->aProcessingEvents[self::PROCESSING_EVENT_AFTER]->call(array($bEndRequest)); |
@@ -404,7 +404,7 @@ discard block |
||
| 404 | 404 | |
| 405 | 405 | $this->getResponseManager()->printDebug(); |
| 406 | 406 | |
| 407 | - if(($this->getOption('core.process.exit'))) |
|
| 407 | + if (($this->getOption('core.process.exit'))) |
|
| 408 | 408 | { |
| 409 | 409 | $this->getResponseManager()->sendOutput(); |
| 410 | 410 | exit(); |
@@ -25,14 +25,9 @@ |
||
| 25 | 25 | |
| 26 | 26 | namespace Jaxon; |
| 27 | 27 | |
| 28 | -use Jaxon\Plugin\Manager as PluginManager; |
|
| 29 | -use Jaxon\Request\Manager as RequestManager; |
|
| 30 | -use Jaxon\Response\Manager as ResponseManager; |
|
| 31 | - |
|
| 32 | 28 | use Jaxon\Utils\URI; |
| 33 | 29 | use Jaxon\Utils\Container; |
| 34 | 30 | use Exception; |
| 35 | -use Closure; |
|
| 36 | 31 | |
| 37 | 32 | class Jaxon |
| 38 | 33 | { |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | * @param string $sLibKey The key of the library options in the file |
| 70 | 70 | * @param string|null $sAppKey The key of the application options in the file |
| 71 | 71 | * |
| 72 | - * @return array |
|
| 72 | + * @return null|\Jaxon\Utils\Config\Config |
|
| 73 | 73 | */ |
| 74 | 74 | public function readPhpConfigFile($sConfigFile, $sLibKey = '', $sAppKey = null) |
| 75 | 75 | { |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | * @param string $sLibKey The key of the library options in the file |
| 84 | 84 | * @param string|null $sAppKey The key of the application options in the file |
| 85 | 85 | * |
| 86 | - * @return array |
|
| 86 | + * @return null|\Jaxon\Utils\Config\Config |
|
| 87 | 87 | */ |
| 88 | 88 | public function readYamlConfigFile($sConfigFile, $sLibKey = '', $sAppKey = null) |
| 89 | 89 | { |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | * @param string $sLibKey The key of the library options in the file |
| 98 | 98 | * @param string|null $sAppKey The key of the application options in the file |
| 99 | 99 | * |
| 100 | - * @return array |
|
| 100 | + * @return \Jaxon\Utils\Config\Config|null |
|
| 101 | 101 | */ |
| 102 | 102 | public function readJsonConfigFile($sConfigFile, $sLibKey = '', $sAppKey = null) |
| 103 | 103 | { |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | * @param string $sLibKey The key of the library options in the file |
| 112 | 112 | * @param string|null $sAppKey The key of the application options in the file |
| 113 | 113 | * |
| 114 | - * @return array |
|
| 114 | + * @return null|\Jaxon\Utils\Config\Config |
|
| 115 | 115 | */ |
| 116 | 116 | public function readConfigFile($sConfigFile, $sLibKey = '', $sAppKey = null) |
| 117 | 117 | { |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | 'core.prefix.event' => 'jaxon_event_', |
| 44 | 44 | // 'core.request.uri' => '', |
| 45 | 45 | 'core.request.mode' => 'asynchronous', |
| 46 | - 'core.request.method' => 'POST', // W3C: Method is case sensitive |
|
| 46 | + 'core.request.method' => 'POST', // W3C: Method is case sensitive |
|
| 47 | 47 | 'core.debug.on' => false, |
| 48 | 48 | 'core.debug.verbose' => false, |
| 49 | 49 | 'core.process.exit' => true, |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | public function readConfigFile($sConfigFile, $sLibKey = '', $sAppKey = null) |
| 117 | 117 | { |
| 118 | 118 | $sExt = pathinfo($sConfigFile, PATHINFO_EXTENSION); |
| 119 | - switch($sExt) |
|
| 119 | + switch ($sExt) |
|
| 120 | 120 | { |
| 121 | 121 | case 'php': |
| 122 | 122 | return $this->readPhpConfigFile($sConfigFile, $sLibKey, $sAppKey); |
@@ -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 | $parameterInstance[] = $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,7 +368,7 @@ 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 | return; |
| 373 | 373 | $reflectionMethod = $this->reflectionClass->getMethod($sMethod); |
| 374 | 374 | $callableObject = $this->getRegisteredObject(); |
@@ -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 | $parameterInstance[] = $this->diGet($parameter->getClass()->getName()); |
| 133 | 134 | } |
| 134 | 135 | $xCallable = $this->reflectionClass->newInstanceArgs($parameterInstance); |
| 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 | |
@@ -368,8 +372,9 @@ discard block |
||
| 368 | 372 | */ |
| 369 | 373 | public function call($sMethod, $aArgs) |
| 370 | 374 | { |
| 371 | - if(!$this->hasMethod($sMethod)) |
|
| 372 | - return; |
|
| 375 | + if(!$this->hasMethod($sMethod)) { |
|
| 376 | + return; |
|
| 377 | + } |
|
| 373 | 378 | $reflectionMethod = $this->reflectionClass->getMethod($sMethod); |
| 374 | 379 | $callableObject = $this->getRegisteredObject(); |
| 375 | 380 | $this->getResponseManager()->append($reflectionMethod->invokeArgs($callableObject, $aArgs)); |