Completed
Push — master ( e2547a...b91078 )
by Tyler
04:34
created

Bandwidth::applyResponse()   A

Complexity

Conditions 4
Paths 8

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 4.7691

Importance

Changes 0
Metric Value
dl 0
loc 12
ccs 7
cts 11
cp 0.6364
rs 9.2
c 0
b 0
f 0
cc 4
eloc 7
nc 8
nop 1
crap 4.7691
1
<?php
2
3
namespace LeadThread\Sms\Responses;
4
5
use LeadThread\Sms\Interfaces\SmsResponse;
6
use Catapult\PhoneNumbersCollection;
7
use Catapult\PhoneNumbers;
8
9
class Bandwidth extends Response
10
{
11 3
    public function applyResponse($response)
12
    {
13 3
        if (isset($response->messageId)) {
14
            $this->uuid = $response->messageId;
15
        }
16 3
        if ($response instanceof PhoneNumbersCollection) {
17 3
            $this->number = $response->first()->number;
18 3
        }
19 3
        if ($response instanceof PhoneNumbers) {
20
            $this->number = $response->number;
0 ignored issues
show
Bug introduced by
The property number does not seem to exist in Catapult\PhoneNumbers.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
21
        }
22 3
    }
23
24
    public function successful()
25
    {
26
        return $this->error === null;
27
    }
28
}
29