PaymentPreferences::setSetupFeeFailureAction()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
1
<?php
2
3
namespace PaymentGateway\PayPalSdk\Subscriptions;
4
5
use PaymentGateway\PayPalSdk\Subscriptions\Constants\InitialPaymentFailureAction;
6
7
class PaymentPreferences
8
{
9
    protected Money $setupFee;
10
11
    protected bool $autoBillOutstanding = true;
12
13
    protected int $paymentFailureThreshold = 0;
14
15
    protected string $setupFeeFailureAction = InitialPaymentFailureAction::CANCEL;
16
17 4
    public function __construct(Money $setupFee)
18
    {
19 4
        $this->setupFee = $setupFee;
20 4
    }
21
22 1
    public function getSetupFee(): Money
23
    {
24 1
        return $this->setupFee;
25
    }
26
27
    public function setSetupFee(Money $setupFee): void
28
    {
29
        $this->setupFee = $setupFee;
30
    }
31
32 1
    public function isAutoBillOutstanding(): bool
33
    {
34 1
        return $this->autoBillOutstanding;
35
    }
36
37
    public function setAutoBillOutstanding(bool $autoBillOutstanding): void
38
    {
39
        $this->autoBillOutstanding = $autoBillOutstanding;
40
    }
41
42 1
    public function getPaymentFailureThreshold(): int
43
    {
44 1
        return $this->paymentFailureThreshold;
45
    }
46
47
    public function setPaymentFailureThreshold(int $paymentFailureThreshold): void
48
    {
49
        $this->paymentFailureThreshold = $paymentFailureThreshold;
50
    }
51
52 1
    public function getSetupFeeFailureAction(): string
53
    {
54 1
        return $this->setupFeeFailureAction;
55
    }
56
57
    public function setSetupFeeFailureAction(string $setupFeeFailureAction): void
58
    {
59
        $this->setupFeeFailureAction = $setupFeeFailureAction;
60
    }
61
62 4
    public function toArray(): array
63
    {
64
        return [
65 4
            'auto_bill_outstanding' => $this->autoBillOutstanding,
66 4
            'setup_fee' => $this->setupFee->toArray(),
67 4
            'setup_fee_failure_action' => $this->setupFeeFailureAction,
68 4
            'payment_failure_threshold' => $this->paymentFailureThreshold
69
        ];
70
    }
71
}
72