AbstractBillingCycle   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Test Coverage

Coverage 70%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 17
c 1
b 0
f 1
dl 0
loc 46
ccs 14
cts 20
cp 0.7
rs 10
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A setTotalCycles() 0 3 1
A getTotalCycles() 0 3 1
A toArray() 0 8 1
A setSequence() 0 3 1
A getSequence() 0 3 1
1
<?php
2
3
namespace PaymentGateway\PayPalSdk\Subscriptions\BillingCycles;
4
5
use PaymentGateway\PayPalSdk\Subscriptions\Frequency;
6
use PaymentGateway\PayPalSdk\Subscriptions\PricingSchema;
7
8
abstract class AbstractBillingCycle
9
{
10
    protected Frequency $frequency;
11
12
    protected PricingSchema $pricingSchema;
13
14
    protected int $sequence = 1;
15
16
    protected int $totalCycles = 1;
17
18 4
    public function __construct(Frequency $frequency, PricingSchema $pricingSchema)
19
    {
20 4
        $this->frequency = $frequency;
21 4
        $this->pricingSchema = $pricingSchema;
22 4
    }
23
24 4
    public function getSequence(): int
25
    {
26 4
        return $this->sequence;
27
    }
28
29
    public function setSequence(int $sequence): void
30
    {
31
        $this->sequence = $sequence;
32
    }
33
34 4
    public function getTotalCycles(): int
35
    {
36 4
        return $this->totalCycles;
37
    }
38
39
    public function setTotalCycles(int $totalCycles): void
40
    {
41
        $this->totalCycles = $totalCycles;
42
    }
43
44
    abstract public function getTenureType(): string;
45
46 4
    public function toArray(): array
47
    {
48
        return [
49 4
            'frequency' => $this->frequency->toArray(),
50 4
            'tenure_type' => $this->getTenureType(),
51 4
            'sequence' => $this->getSequence(),
52 4
            'total_cycles' => $this->getTotalCycles(),
53 4
            'pricing_scheme' => $this->pricingSchema->toArray(),
54
        ];
55
    }
56
}
57