* @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;
}
public function setItemsPerPage(int $items) {
$this->perPage = $items;
}
-
+
/**
* get the status code
* @return int
public function getStatusCode() {
return $this->statusCode;
}
-
+
/**
* get the meta data for the result
* @return array
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