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

PaymentPreferences::toArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 5
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 7
ccs 5
cts 5
cp 1
crap 1
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 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