1 | <?php |
||
19 | class Response |
||
20 | { |
||
21 | /** |
||
22 | * @var mixed |
||
23 | */ |
||
24 | protected $content; |
||
25 | |||
26 | /** |
||
27 | * @var integer |
||
28 | */ |
||
29 | protected $statusCode; |
||
30 | |||
31 | /** |
||
32 | * @var string |
||
33 | */ |
||
34 | protected $format; |
||
35 | |||
36 | /** |
||
37 | * Constructor class. |
||
38 | * |
||
39 | * @param mixed $content The content of response. |
||
40 | * @param integer $statusCode The status code of response. |
||
41 | */ |
||
42 | public function __construct($content, $statusCode) |
||
47 | |||
48 | /** |
||
49 | * Getter for content. |
||
50 | * |
||
51 | * @return mixed |
||
52 | */ |
||
53 | public function getContent() |
||
57 | |||
58 | /** |
||
59 | * Getter for status code. |
||
60 | * |
||
61 | * @return integer |
||
62 | */ |
||
63 | public function getStatusCode() |
||
67 | |||
68 | /** |
||
69 | * The setter for response format. |
||
70 | * |
||
71 | * @param string $format The response format. |
||
72 | * |
||
73 | * @void |
||
74 | */ |
||
75 | public function setResponseFormat($format = 'json') |
||
79 | |||
80 | /** |
||
81 | * The getter the response format. |
||
82 | * |
||
83 | * @return string The response format. |
||
84 | */ |
||
85 | public function getResponseFormat() |
||
89 | |||
90 | /** |
||
91 | * Tests whether the response is a valid json or not. |
||
92 | * |
||
93 | * @return boolean |
||
94 | */ |
||
95 | public function isJson() |
||
101 | |||
102 | /** |
||
103 | * Tests whether the response is a valid xml or not. |
||
104 | * |
||
105 | * @return boolean |
||
106 | */ |
||
107 | public function isXml() |
||
117 | |||
118 | /** |
||
119 | * Tests whether the response is ok or not. |
||
120 | * |
||
121 | * @return boolean |
||
122 | */ |
||
123 | public function isSuccess() |
||
127 | |||
128 | /** |
||
129 | * Tests whether there's a froward or not. |
||
130 | * |
||
131 | * @return boolean |
||
132 | */ |
||
133 | public function isForward() |
||
137 | |||
138 | /** |
||
139 | * Tests whether there's a client error. |
||
140 | * |
||
141 | * @return boolean |
||
142 | */ |
||
143 | public function isClientError() |
||
147 | |||
148 | /** |
||
149 | * Tests whether there's an internal error or not. |
||
150 | * |
||
151 | * @return boolean |
||
152 | */ |
||
153 | public function isInternetError() |
||
157 | |||
158 | /** |
||
159 | * Creates a response. |
||
160 | * |
||
161 | * @param mixed $content The content of response. |
||
162 | * @param integer $statusCode The code status of response. |
||
163 | * |
||
164 | * @return \static |
||
165 | */ |
||
166 | public static function create($content, $statusCode) |
||
170 | } |
||
171 |