@@ -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,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 | $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 | |
@@ -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)); |