Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/Service/Account/Numbers.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ protected function validateResponse(array $json)
if (!isset($json['count'])) {
throw new Exception('count property expected');
}
if (0 == $json['count']) {
// If there are no numbers on the account, stop validating.
return;
}
if (!isset($json['numbers']) || !is_array($json['numbers'])) {
throw new Exception('numbers array property expected');
}
Expand All @@ -67,9 +71,6 @@ protected function validateResponse(array $json)
if (!isset($number['features']) || !is_array($number['features'])) {
throw new Exception('number.features array property expected');
}
if (!isset($number['moHttpUrl'])) {
throw new Exception('number.moHttpUrl property expected');
}
}
}
}
7 changes: 6 additions & 1 deletion src/Service/Account/Pricing/Country.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ public function invoke($country = null)
}

return new Entity\Pricing($this->exec([
'country' => $country,
// Nexmo API requires $country value to be uppercase.
'country' => strtoupper($country),
]));
}

Expand All @@ -43,6 +44,10 @@ public function invoke($country = null)
*/
protected function validateResponse(array $json)
{
if (!isset($json['mt'])) {
// Some countries don't have any values, e.g., BV.
return;
}
if (!isset($json['country'])) {
throw new Exception('country property expected');
}
Expand Down