summaryrefslogtreecommitdiffstats
path: root/apps/files_external/lib/definitionparameter.php
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2016-01-26 14:40:55 +0100
committerRobin Appelman <icewind@owncloud.com>2016-01-29 14:51:30 +0100
commitd0f56876877d5681a6faf5e8882c4de48a9bd4dc (patch)
treed806946d478fc5f79cfae219d22ab78bddc34158 /apps/files_external/lib/definitionparameter.php
parentefcf790eff211afc220e298383874733fb907181 (diff)
downloadnextcloud-server-d0f56876877d5681a6faf5e8882c4de48a9bd4dc.tar.gz
nextcloud-server-d0f56876877d5681a6faf5e8882c4de48a9bd4dc.zip
Dont set null values when validating storage definition
Diffstat (limited to 'apps/files_external/lib/definitionparameter.php')
-rw-r--r--apps/files_external/lib/definitionparameter.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/apps/files_external/lib/definitionparameter.php b/apps/files_external/lib/definitionparameter.php
index 85c3dd08ad4..dc7985837f5 100644
--- a/apps/files_external/lib/definitionparameter.php
+++ b/apps/files_external/lib/definitionparameter.php
@@ -154,6 +154,10 @@ class DefinitionParameter implements \JsonSerializable {
return $prefix . $this->getText();
}
+ public function isOptional() {
+ return $this->isFlagSet(self::FLAG_OPTIONAL) || $this->isFlagSet(self::FLAG_USER_PROVIDED);
+ }
+
/**
* Validate a parameter value against this
* Convert type as necessary
@@ -162,8 +166,6 @@ class DefinitionParameter implements \JsonSerializable {
* @return bool success
*/
public function validateValue(&$value) {
- $optional = $this->isFlagSet(self::FLAG_OPTIONAL) || $this->isFlagSet(self::FLAG_USER_PROVIDED);
-
switch ($this->getType()) {
case self::VALUE_BOOLEAN:
if (!is_bool($value)) {
@@ -180,7 +182,7 @@ class DefinitionParameter implements \JsonSerializable {
}
break;
default:
- if (!$value && !$optional) {
+ if (!$value && !$this->isOptional()) {
return false;
}
break;