@@ -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 | |
@@ -90,13 +90,13 @@ discard block |
||
| 90 | 90 | { |
| 91 | 91 | $this->aConfiguration = array(); |
| 92 | 92 | $this->sAlias = ''; |
| 93 | - if(is_array($sUserFunction)) |
|
| 93 | + if (is_array($sUserFunction)) |
|
| 94 | 94 | { |
| 95 | - if(count($sUserFunction) != 2 && count($sUserFunction) != 3) |
|
| 95 | + if (count($sUserFunction) != 2 && count($sUserFunction) != 3) |
|
| 96 | 96 | { |
| 97 | 97 | throw new \Jaxon\Exception\Error($this->trans('errors.functions.invalid-declaration')); |
| 98 | 98 | } |
| 99 | - if(count($sUserFunction) == 3) |
|
| 99 | + if (count($sUserFunction) == 3) |
|
| 100 | 100 | { |
| 101 | 101 | $this->sAlias = $sUserFunction[0]; |
| 102 | 102 | $this->sUserFunction = array_slice($sUserFunction, 1); |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | $this->sUserFunction = $sUserFunction; |
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | - elseif(is_string($sUserFunction)) |
|
| 109 | + elseif (is_string($sUserFunction)) |
|
| 110 | 110 | { |
| 111 | 111 | $this->sUserFunction = $sUserFunction; |
| 112 | 112 | } |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | public function getName() |
| 125 | 125 | { |
| 126 | 126 | // Do not use sAlias here! |
| 127 | - if(is_array($this->sUserFunction)) |
|
| 127 | + if (is_array($this->sUserFunction)) |
|
| 128 | 128 | { |
| 129 | 129 | return $this->sUserFunction[1]; |
| 130 | 130 | } |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | */ |
| 142 | 142 | public function configure($sName, $sValue) |
| 143 | 143 | { |
| 144 | - switch($sName) |
|
| 144 | + switch ($sName) |
|
| 145 | 145 | { |
| 146 | 146 | case 'alias': |
| 147 | 147 | $this->sAlias = $sValue; |
@@ -195,12 +195,12 @@ discard block |
||
| 195 | 195 | */ |
| 196 | 196 | public function call($aArgs = array()) |
| 197 | 197 | { |
| 198 | - if(($this->sInclude)) |
|
| 198 | + if (($this->sInclude)) |
|
| 199 | 199 | { |
| 200 | 200 | require_once $this->sInclude; |
| 201 | 201 | } |
| 202 | 202 | $response = call_user_func_array($this->sUserFunction, $aArgs); |
| 203 | - if(($response)) |
|
| 203 | + if (($response)) |
|
| 204 | 204 | { |
| 205 | 205 | $this->getResponseManager()->append($response); |
| 206 | 206 | } |