summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorTom Needham <needham.thomas@gmail.com>2014-02-10 13:43:16 +0000
committerTom Needham <needham.thomas@gmail.com>2014-02-10 13:43:16 +0000
commit84607db284265c2ec86873f0e717eb0466d9fae8 (patch)
tree51a3abe0ad60a0663ea67ad3e5790f2137e09fc6 /lib/private
parenteba1d574cf946c215ca3fd3154ecc3bfe5742d2b (diff)
parentdc53c83e7bdbadeb24c74fe1c7794de54811c264 (diff)
downloadnextcloud-server-84607db284265c2ec86873f0e717eb0466d9fae8.tar.gz
nextcloud-server-84607db284265c2ec86873f0e717eb0466d9fae8.zip
Merge pull request #6988 from owncloud/oc_api_fix_warinigs
[ocs API] getData() always needs to return an array
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/ocs/result.php18
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/private/ocs/result.php b/lib/private/ocs/result.php
index 84f06fa01c7..9f14e8da7e8 100644
--- a/lib/private/ocs/result.php
+++ b/lib/private/ocs/result.php
@@ -29,7 +29,13 @@ class OC_OCS_Result{
* @param $data mixed the data to return
*/
public function __construct($data=null, $code=100, $message=null) {
- $this->data = $data;
+ if ($data === null) {
+ $this->data = array();
+ } elseif (!is_array($data)) {
+ $this->data = array($this->data);
+ } else {
+ $this->data = $data;
+ }
$this->statusCode = $code;
$this->message = $message;
}
@@ -49,7 +55,7 @@ class OC_OCS_Result{
public function setItemsPerPage(int $items) {
$this->perPage = $items;
}
-
+
/**
* get the status code
* @return int
@@ -57,7 +63,7 @@ class OC_OCS_Result{
public function getStatusCode() {
return $this->statusCode;
}
-
+
/**
* get the meta data for the result
* @return array
@@ -76,15 +82,15 @@ class OC_OCS_Result{
return $meta;
}
-
+
/**
* get the result data
- * @return array|string|int
+ * @return array
*/
public function getData() {
return $this->data;
}
-
+
/**
* return bool if the method succedded
* @return bool