Passed
Pull Request — 1.x (#36)
by Darío
04:17 queued 02:03
created

PaymentMethod::toArray()   A

Complexity

Conditions 4
Paths 8

Size

Total Lines 17
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 20

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 17
ccs 0
cts 9
cp 0
rs 10
cc 4
nc 8
nop 0
crap 20
1
<?php
2
3
namespace PaymentGateway\PayPalSdk\Subscriptions;
4
5
class PaymentMethod
6
{
7
    private ?string $payerSelected;
8
    private ?string $payeePreferred;
9
    private ?string $standardEntryClassCode;
10
11
    public function getPayerSelected(): ?string
12
    {
13
        return $this->payerSelected;
14
    }
15
16
    public function setPayerSelected(?string $payerSelected): self
17
    {
18
        $this->payerSelected = $payerSelected;
19
20
        return $this;
21
    }
22
23
    public function getPayeePreferred(): ?string
24
    {
25
        return $this->payeePreferred;
26
    }
27
28
    public function setPayeePreferred(?string $payeePreferred): self
29
    {
30
        $this->payeePreferred = $payeePreferred;
31
32
        return $this;
33
    }
34
35
    public function getStandardEntryClassCode(): ?string
36
    {
37
        return $this->standardEntryClassCode;
38
    }
39
40
    public function setStandardEntryClassCode(?string $standardEntryClassCode): self
41
    {
42
        $this->standardEntryClassCode = $standardEntryClassCode;
43
44
        return $this;
45
    }
46
47
    public function toArray(): array
48
    {
49
        $data = [];
50
51
        if ($this->payerSelected) {
52
            $data['payer_selected'] = $this->payerSelected;
53
        }
54
55
        if ($this->payeePreferred) {
56
            $data['payee_preferred'] = $this->payeePreferred;
57
        }
58
59
        if ($this->standardEntryClassCode) {
60
            $data['standard_entry_class_code'] = $this->standardEntryClassCode;
61
        }
62
63
        return $data;
64
    }
65
}
66