Skip to content

Commit 8333166

Browse files
committed
Merge branch 'develop' of github.com:Nexmo/php-sdk into develop
2 parents dc14add + b01ea66 commit 8333166

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

src/Nexmo/Message/Response/Message.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,12 @@ public function __construct(Array $data, Receipt $receipt = null)
2121
'status',
2222
'message-id',
2323
'to',
24-
'remaining-balance',
2524
'message-price',
2625
'network'
2726
);
2827

2928
//default value
30-
$data = array_merge(array('client-ref' => null), $data);
29+
$data = array_merge(array('client-ref' => null, 'remaining-balance' => null), $data);
3130

3231
$return = parent::__construct($data);
3332

src/Nexmo/Voice/Message/Callback.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ class Callback extends BaseCallback implements CallbackInterface
2020
'to',
2121
'call-request',
2222
'network-code',
23-
'call-start',
24-
'call-end'
2523
);
2624

2725
public function getId()
@@ -61,11 +59,19 @@ public function getCreated()
6159

6260
public function getStart()
6361
{
62+
if(!isset($this->data['call-start'])){
63+
return null;
64+
}
65+
6466
return \DateTime::createFromFormat(self::TIME_FORMAT, $this->data['call-start']);
6567
}
6668

6769
public function getEnd()
6870
{
71+
if(!isset($this->data['call-end'])){
72+
return null;
73+
}
74+
6975
return \DateTime::createFromFormat(self::TIME_FORMAT, $this->data['call-end']);
7076
}
7177

tests/Nexmo/Voice/Message/CallbackTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@ public function testSimpleValues()
3939
$this->assertEquals($this->data['to'], $this->callback->getTo());
4040
$this->assertEquals($this->data['network-code'], $this->callback->getNetwork());
4141
}
42+
public function testStartAndEndOptional()
43+
{
44+
unset($this->data['call-start']);
45+
unset($this->data['call-end']);
46+
47+
$this->callback = new Callback($this->data);
48+
49+
$this->assertNull($this->callback->getStart());
50+
$this->assertNull($this->callback->getEnd());
51+
}
4252

4353
public function testDateValues()
4454
{

0 commit comments

Comments
 (0)