1 | <?php |
||
9 | class XmlApiResponse implements ApplicationIResponse |
||
10 | { |
||
11 | /** |
||
12 | * @var integer |
||
13 | */ |
||
14 | private $code; |
||
15 | |||
16 | /** @var null|string */ |
||
17 | private $response = null; |
||
18 | |||
19 | /** |
||
20 | * Create XmlApiResponse |
||
21 | * This class only wrap JsonResponse from Nette and add possibility |
||
22 | * to setup response code and automaticaly set content type |
||
23 | * |
||
24 | * @param integer $code |
||
25 | * @param mixed $data |
||
26 | */ |
||
27 | public function __construct($code, $data) |
||
33 | |||
34 | /** |
||
35 | * Return api response http code |
||
36 | * |
||
37 | * @return integer |
||
38 | */ |
||
39 | public function getCode() |
||
43 | |||
44 | public function send(IRequest $httpRequest, IResponse $httpResponse) |
||
57 | } |
||
58 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: