| 1 | <?php |
||
| 16 | final class Response |
||
| 17 | { |
||
| 18 | public const TYPE_ERROR = 0x8000; |
||
| 19 | |||
| 20 | private $header; |
||
| 21 | private $body; |
||
| 22 | |||
| 23 | 432 | public function __construct(array $header, array $body) |
|
| 28 | |||
| 29 | 366 | public function isError() : bool |
|
| 35 | |||
| 36 | 63 | public function getCode() : int |
|
| 40 | |||
| 41 | 387 | public function getSync() : int |
|
| 45 | |||
| 46 | 3 | public function getSchemaId() : int |
|
| 50 | |||
| 51 | /** |
||
| 52 | * @return mixed |
||
| 53 | */ |
||
| 54 | 359 | public function getBodyField(int $key) |
|
| 62 | |||
| 63 | /** |
||
| 64 | * @param mixed $default |
||
| 65 | * |
||
| 66 | * @return mixed |
||
| 67 | */ |
||
| 68 | 12 | public function tryGetBodyField(int $key, $default = null) |
|
| 69 | { |
||
| 70 | 12 | return \array_key_exists($key, $this->body) ? $this->body[$key] : $default; |
|
| 71 | } |
||
| 72 | |||
| 73 | 6 | public function hasBodyField(int $key) : bool |
|
| 77 | } |
||
| 78 |