-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathApiResponse.php
More file actions
40 lines (34 loc) · 851 Bytes
/
ApiResponse.php
File metadata and controls
40 lines (34 loc) · 851 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
/**
* Created by PhpStorm.
* User: davidamackenzie
* Date: 9/29/18
* Time: 2:44 PM
*/
class ApiResponse {
public $status, $errorMessage, $data, $resource;
function __construct($resource) {
$this->status = 0;
$this->errorMessage = '';
$this->data = [];
$this->resource = $resource;
}
public function getResponse() {
$response = [
'status'=>$this->status,
'errorMessage'=>$this->errorMessage,
'data'=>$this->data,
'resource'=>$this->resource
];
return $response;
}
public function setStatus($status) {
$this->status = $status;
}
public function setErrorMessage($message) {
$this->errorMessage = $message;
}
public function setData($data) {
$this->data = $data;
}
}