Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
20 / 20 |
|
100.00% |
11 / 11 |
CRAP | |
100.00% |
1 / 1 |
Response | |
100.00% |
20 / 20 |
|
100.00% |
11 / 11 |
16 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
10 / 10 |
|
100.00% |
1 / 1 |
6 | |||
getHeaders | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setHeaders | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getBody | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setBody | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getResponse | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setResponse | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getCookies | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setCookies | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getFilename | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setFilename | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | declare(strict_types=1); |
4 | |
5 | namespace Beyondwords\Wordpress\Core; |
6 | |
7 | class Response |
8 | { |
9 | private $headers; |
10 | private $body; |
11 | private $response; |
12 | private $cookies; |
13 | private $filename; |
14 | |
15 | /** |
16 | * @param array $response |
17 | */ |
18 | public function __construct($response = array()) |
19 | { |
20 | if (array_key_exists('headers', $response)) { |
21 | $this->headers = $response['headers']; |
22 | } |
23 | |
24 | if (array_key_exists('body', $response)) { |
25 | $this->body = $response['body']; |
26 | } |
27 | |
28 | if (array_key_exists('response', $response)) { |
29 | $this->response = $response['response']; |
30 | } |
31 | |
32 | if (array_key_exists('cookies', $response)) { |
33 | $this->cookies = $response['cookies']; |
34 | } |
35 | |
36 | if (array_key_exists('filename', $response)) { |
37 | $this->filename = $response['filename']; |
38 | } |
39 | } |
40 | |
41 | /** |
42 | * @return mixed |
43 | */ |
44 | public function getHeaders() |
45 | { |
46 | return $this->headers; |
47 | } |
48 | |
49 | /** |
50 | * @param mixed $headers |
51 | */ |
52 | public function setHeaders($headers) |
53 | { |
54 | $this->headers = $headers; |
55 | } |
56 | |
57 | /** |
58 | * @return mixed |
59 | */ |
60 | public function getBody() |
61 | { |
62 | return $this->body; |
63 | } |
64 | |
65 | /** |
66 | * @param mixed $body |
67 | */ |
68 | public function setBody($body) |
69 | { |
70 | $this->body = $body; |
71 | } |
72 | |
73 | /** |
74 | * @return mixed |
75 | */ |
76 | public function getResponse() |
77 | { |
78 | return $this->response; |
79 | } |
80 | |
81 | /** |
82 | * @param mixed $response |
83 | */ |
84 | public function setResponse($response) |
85 | { |
86 | $this->response = $response; |
87 | } |
88 | |
89 | /** |
90 | * @return mixed |
91 | */ |
92 | public function getCookies() |
93 | { |
94 | return $this->cookies; |
95 | } |
96 | |
97 | /** |
98 | * @param mixed $cookies |
99 | */ |
100 | public function setCookies($cookies) |
101 | { |
102 | $this->cookies = $cookies; |
103 | } |
104 | |
105 | /** |
106 | * @return mixed |
107 | */ |
108 | public function getFilename() |
109 | { |
110 | return $this->filename; |
111 | } |
112 | |
113 | /** |
114 | * @param mixed $filename |
115 | */ |
116 | public function setFilename($filename) |
117 | { |
118 | $this->filename = $filename; |
119 | } |
120 | } |