Skip to content

Commit 101bec8

Browse files
ursuleacvmheap
authored andcommitted
Add getFinalStatus method
The key "status" is not always available in the response and it throws a notice error "Undefined index: status" when calling `$message->getStatus();` Also added `getFinalStatus()` method
1 parent 206e88e commit 101bec8

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/Message/Message.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,12 @@ public function getStatus($index = null)
126126
{
127127
return $this->getMessageData('status', $index);
128128
}
129-
129+
130+
public function getFinalStatus($index = null)
131+
{
132+
return $this->getMessageData('final-status', $index);
133+
}
134+
130135
public function getTo($index = null)
131136
{
132137
$data = $this->getResponseData();
@@ -221,7 +226,7 @@ protected function getMessageData($name, $index = null)
221226
return $data['messages'][$index][$name];
222227
}
223228

224-
return $data[$name];
229+
return isset($data[$name]) ? $data[$name] : null;
225230
}
226231

227232
protected function preGetRequestDataHook()

0 commit comments

Comments
 (0)