Passed
Pull Request — 1.x (#36)
by Darío
09:41 queued 06:52
created

PayerName::setGivenName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

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