summaryrefslogtreecommitdiffstats
path: root/lib/private/appframework/utility
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-05-13 10:40:49 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-05-13 10:40:49 +0200
commita152e320f6aa98774950eb088588cd16387226f8 (patch)
tree4af5190252e9229dd90c84213fcad07950f65822 /lib/private/appframework/utility
parentc06063255f8d93b32452e19819f39cb53d5d4ae3 (diff)
downloadnextcloud-server-a152e320f6aa98774950eb088588cd16387226f8.tar.gz
nextcloud-server-a152e320f6aa98774950eb088588cd16387226f8.zip
make it possible to omit parameters and use the default parameters from the controller method
Diffstat (limited to 'lib/private/appframework/utility')
-rw-r--r--lib/private/appframework/utility/controllermethodreflector.php9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/private/appframework/utility/controllermethodreflector.php b/lib/private/appframework/utility/controllermethodreflector.php
index c9cdadcca4a..a1519c72809 100644
--- a/lib/private/appframework/utility/controllermethodreflector.php
+++ b/lib/private/appframework/utility/controllermethodreflector.php
@@ -59,7 +59,12 @@ class ControllerMethodReflector {
// get method parameters
foreach ($reflection->getParameters() as $param) {
- $this->parameters[] = $param->name;
+ if($param->isOptional()) {
+ $default = $param->getDefaultValue();
+ } else {
+ $default = null;
+ }
+ $this->parameters[$param->name] = $default;
}
}
@@ -81,7 +86,7 @@ class ControllerMethodReflector {
/**
- * @return array the arguments of the method
+ * @return array the arguments of the method with key => default value
*/
public function getParameters() {
return $this->parameters;