| 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 | 3 | public function __construct($code, $data) |
|
| 32 | |||
| 33 | /** |
||
| 34 | * Return api response http code |
||
| 35 | * |
||
| 36 | * @return integer |
||
| 37 | */ |
||
| 38 | 3 | public function getCode() |
|
| 42 | |||
| 43 | public function send(IRequest $httpRequest, IResponse $httpResponse) |
||
| 56 | } |
||
| 57 |
In PHP, under loose comparison (like
==, or!=, orswitchconditions), values of different types might be equal.For
stringvalues, the empty string''is a special case, in particular the following results might be unexpected: