| 1 | <?php |
||
| 5 | class CommandResponse |
||
| 6 | { |
||
| 7 | |||
| 8 | private $data; |
||
| 9 | private $mapData; |
||
| 10 | private $errors = []; |
||
| 11 | private $commandName; |
||
| 12 | private $waitstate; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * @param string $commandName |
||
| 16 | * @param array $data |
||
| 17 | * @param array $mapData |
||
| 18 | */ |
||
| 19 | public function __construct($commandName, array $data = [], array $mapData = []) |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @param string $error |
||
| 28 | */ |
||
| 29 | public function addError(string $error) |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @return array |
||
| 36 | */ |
||
| 37 | public function getContents(): array |
||
| 38 | { |
||
| 39 | return array_filter( |
||
| 40 | [ |
||
| 41 | 'commandName' => $this->commandName, |
||
| 42 | 'data' => $this->data, |
||
| 43 | 'mapData' => $this->mapData, |
||
| 44 | 'waitstate' => $this->waitstate, |
||
| 45 | 'errors' => $this->errors, |
||
| 46 | ] |
||
| 47 | ); |
||
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | * @param array $data |
||
| 52 | */ |
||
| 53 | public function setData(array $data) |
||
| 57 | |||
| 58 | /** |
||
| 59 | * @return array |
||
| 60 | */ |
||
| 61 | public function getMapData(): array |
||
| 65 | |||
| 66 | /** |
||
| 67 | * @param array $mapData |
||
| 68 | */ |
||
| 69 | public function setMapData(array $mapData) |
||
| 73 | |||
| 74 | /** |
||
| 75 | * @param int $waitstate |
||
| 76 | */ |
||
| 77 | public function setWaitstate(int $waitstate) |
||
| 81 | } |
||
| 82 |