Passed
Push — feature/refactor-subscription-... ( 326c18 )
by Darío
03:04
created

Phone::getPhoneType()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace PaymentGateway\PayPalSdk\Subscriptions;
4
5
class Phone
6
{
7
    private string $phoneNumber;
8
    private ?string $phoneType = null;
9
10 5
    public function __construct(string $phoneNumber)
11
    {
12 5
        $this->phoneNumber = $phoneNumber;
13 5
    }
14
15 1
    public function getPhoneNumber(): string
16
    {
17 1
        return $this->phoneNumber;
18
    }
19
20 1
    public function setPhoneNumber(string $phoneNumber): self
21
    {
22 1
        $this->phoneNumber = $phoneNumber;
23
24 1
        return $this;
25
    }
26
27 1
    public function getPhoneType(): ?string
28
    {
29 1
        return $this->phoneType;
30
    }
31
32 2
    public function setPhoneType(?string $phoneType): self
33
    {
34 2
        $this->phoneType = $phoneType;
35
36 2
        return $this;
37
    }
38
39 3
    public function toArray(): array
40
    {
41
        $data = [
42 3
            'phone_number' => $this->phoneNumber,
43
        ];
44
45 3
        if ($this->phoneType) {
46 1
            $data['phone_type'] = $this->phoneType;
47
        }
48
49 3
        return $data;
50
    }
51
}
52