Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2014-02-10 18:55:47 +0400
committerBjoern Schiessle <schiessle@owncloud.com>2014-02-10 18:55:47 +0400
commit5e24e21493299a691f22916a3bd2200bd1142afc (patch)
tree10320eba3231d6cf4dae5c0eceec26ce06fe6002 /lib
parentb4b05c32916ee9bbb1edbf57a76a1ae2684c38d3 (diff)
getData() always needs to return an array, backport of #6988
Diffstat (limited to 'lib')
-rw-r--r--lib/ocs/result.php18
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/ocs/result.php b/lib/ocs/result.php
index 8ab378d79c5..8bd51add7e6 100644
--- a/lib/ocs/result.php
+++ b/lib/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