| Total Complexity | 9 |
| Total Lines | 64 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | class SmsUpResponse |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @var string |
||
| 13 | */ |
||
| 14 | private $status; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @var array |
||
| 18 | */ |
||
| 19 | private $result; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @var string |
||
| 23 | */ |
||
| 24 | private $errorId; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @var string |
||
| 28 | */ |
||
| 29 | private $errorMsg; |
||
| 30 | |||
| 31 | public function __construct(array $response) |
||
| 32 | { |
||
| 33 | $this->status = $response['status']; |
||
| 34 | $this->errorId = isset($response['error_id']) ? $response['error_id'] : ''; |
||
| 35 | $this->errorMsg = isset($response['error_msg']) ? $response['error_msg'] : ''; |
||
| 36 | foreach ($response['result'] as $responseMessage) { |
||
| 37 | if (array_key_exists('status', $response)) { |
||
| 38 | $this->result[] = new SmsUpResponseMessage($responseMessage); |
||
| 39 | } |
||
| 40 | } |
||
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | * @return string|null |
||
| 45 | */ |
||
| 46 | public function getStatus() |
||
| 47 | { |
||
| 48 | return $this->status; |
||
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * @return array |
||
| 53 | */ |
||
| 54 | public function getResult() |
||
| 55 | { |
||
| 56 | return $this->result; |
||
| 57 | } |
||
| 58 | |||
| 59 | /** |
||
| 60 | * @return string|null |
||
| 61 | */ |
||
| 62 | public function getErrorId() |
||
| 65 | } |
||
| 66 | |||
| 67 | /** |
||
| 68 | * @return string|null |
||
| 69 | */ |
||
| 70 | public function getErrorMsg() |
||
| 73 | } |
||
| 74 | } |