Bandwidth::successful()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
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
            $this->numbers = collect($response->toArray())->pluck("number")->all();
19 3
        }
20 3
        if ($response instanceof PhoneNumbers) {
21
            $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...
22
        }
23 3
    }
24
25
    public function successful()
26
    {
27
        return $this->error === null;
28
    }
29
}
30