1 | <?php |
||
7 | class Response |
||
8 | { |
||
9 | # The actual Guzzle response: |
||
10 | private $response; |
||
11 | |||
12 | # Core response: |
||
13 | private $headers; |
||
14 | private $bodyRaw; |
||
15 | private $body; |
||
16 | |||
17 | # Properties: |
||
18 | private $statusCode; |
||
19 | private $timestamp; |
||
20 | |||
21 | function __construct( \GuzzleHttp\Psr7\Response $response = null ) |
||
32 | |||
33 | /****************************/ |
||
34 | /* */ |
||
35 | /* GETTERS */ |
||
36 | /* */ |
||
37 | /****************************/ |
||
38 | |||
39 | # Get the status code: |
||
40 | public function getStatusCode() |
||
44 | |||
45 | #ÊGet the timestamp of the request: |
||
46 | public function getTimestamp() |
||
50 | |||
51 | #ÊGet the timestamp of the request: |
||
52 | public function getData() |
||
56 | |||
57 | #ÊConvert the response to JSON: |
||
58 | public function toJSON() |
||
66 | } |
||
67 |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.