Passed
Push — feature/billing-plans ( ede562 )
by Darío
07:23
created

PaymentPreferences   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 11
c 1
b 0
f 1
dl 0
loc 22
ccs 8
cts 8
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A toArray() 0 7 1
A __construct() 0 3 1
1
<?php
2
3
namespace PaymentGateway\PayPalSdk\Subscriptions;
4
5
use PaymentGateway\PayPalSdk\Subscriptions\Constants\InitialPaymentFailureAction;
6
7
class PaymentPreferences
8
{
9
    protected bool $autoBillOutstanding = true;
10
11
    protected Money $setupFee;
12
13
    protected string $setupFeeFailureAction = InitialPaymentFailureAction::CANCEL;
14
15
    protected int $paymentFailureThreshold = 0;
16
17 3
    public function __construct(Money $setupFee)
18
    {
19 3
        $this->setupFee = $setupFee;
20 3
    }
21
22 3
    public function toArray(): array
23
    {
24
        return [
25 3
            'auto_bill_outstanding' => $this->autoBillOutstanding,
26 3
            'setup_fee' => $this->setupFee->toArray(),
27 3
            'setup_fee_failure_action' => $this->setupFeeFailureAction,
28 3
            'payment_failure_threshold' => $this->paymentFailureThreshold
29
        ];
30
    }
31
}
32