Skip to content

Commit 59a3f17

Browse files
committed
Added a check
Added a check when working with SMSUp response because sometimes the status does not come and in our system it is necessary
1 parent 5ae14bb commit 59a3f17

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

src/SmsUpReportResponse.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ class SmsUpReportResponse
1616
public function __construct(array $response)
1717
{
1818
foreach ($response as $responseMessage) {
19-
$this->responseMessages[] = new SmsUpReportResponseMessage($responseMessage);
19+
if (array_key_exists('status', $response)) {
20+
$this->responseMessages[] = new SmsUpReportResponseMessage($responseMessage);
21+
}
2022
}
2123
}
2224

src/SmsUpReportResponseMessage.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class SmsUpReportResponseMessage
4545

4646
public function __construct(array $response)
4747
{
48+
4849
$this->status = $response['status'];
4950
$this->smsId = $response['sms_id'];
5051
$this->from = $response['from'];

src/SmsUpResponse.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ public function __construct(array $response)
3434
$this->errorId = isset($response['error_id']) ? $response['error_id'] : '';
3535
$this->errorMsg = isset($response['error_msg']) ? $response['error_msg'] : '';
3636
foreach ($response['result'] as $responseMessage) {
37-
$this->result[] = new SmsUpResponseMessage($responseMessage);
37+
if (array_key_exists('status', $response)) {
38+
$this->result[] = new SmsUpResponseMessage($responseMessage);
39+
}
3840
}
3941
}
4042

0 commit comments

Comments
 (0)