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

PaymentMethod   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 10
eloc 21
c 1
b 0
f 0
dl 0
loc 59
ccs 0
cts 24
cp 0
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getPayerSelected() 0 3 1
A getPayeePreferred() 0 3 1
A setPayeePreferred() 0 5 1
A getStandardEntryClassCode() 0 3 1
A setPayerSelected() 0 5 1
A toArray() 0 17 4
A setStandardEntryClassCode() 0 5 1
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