| 1 | <?php |
||
| 6 | abstract class BaseResponse implements ResponseInterface |
||
| 7 | { |
||
| 8 | /** |
||
| 9 | * Command |
||
| 10 | * |
||
| 11 | * @var CommandInterface |
||
| 12 | */ |
||
| 13 | protected $command; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * Response body |
||
| 17 | * |
||
| 18 | * @var mixed |
||
| 19 | */ |
||
| 20 | protected $body; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * Set command |
||
| 24 | * |
||
| 25 | * @param CommandInterface $command Command |
||
| 26 | */ |
||
| 27 | public function setCommand(CommandInterface $command) |
||
| 28 | { |
||
| 29 | $this->command = $command; |
||
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * Set response body |
||
| 34 | * |
||
| 35 | * @param mixed $body Response body |
||
| 36 | * @throws InvalidResponseException |
||
| 37 | */ |
||
| 38 | public function setBody($body) |
||
| 39 | { |
||
| 40 | $this->body = $body; |
||
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | * Parse response |
||
| 45 | * |
||
| 46 | * @return mixed Parsed response |
||
| 47 | * @throws InvalidResponseException |
||
| 48 | */ |
||
| 49 | abstract public function parse(); |
||
| 50 | } |