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

ShippingAddress::getName()   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 ShippingAddress
6
{
7
    private ?ShippingDetailName $name = null;
8
    private ?ShippingDetailAddressPortable $address = null;
9
10 1
    public function getName(): ?ShippingDetailName
11
    {
12 1
        return $this->name;
13
    }
14
15 4
    public function setName(?ShippingDetailName $name): self
16
    {
17 4
        $this->name = $name;
18
19 4
        return $this;
20
    }
21
22 1
    public function getAddress(): ?ShippingDetailAddressPortable
23
    {
24 1
        return $this->address;
25
    }
26
27 2
    public function setAddress(?ShippingDetailAddressPortable $address): self
28
    {
29 2
        $this->address = $address;
30
31 2
        return $this;
32
    }
33
34 4
    public function toArray(): array
35
    {
36 4
        $data = [];
37
38 4
        if ($this->name) {
39 2
            $data['name'] = $this->name->toArray();
40
        }
41
42 4
        if ($this->address) {
43 1
            $data['address'] = $this->address->toArray();
44
        }
45
46 4
        return $data;
47
    }
48
}
49