Passed
Pull Request — 2.x (#43)
by Darío
04:28 queued 02:16
created

BillingCycleSet   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A addBillingCycle() 0 3 1
A getBillingCycles() 0 3 1
A toArray() 0 9 2
1
<?php
2
3
namespace PaymentGateway\PayPalSdk\Subscriptions\BillingCycles;
4
5
class BillingCycleSet
6
{
7
    /**
8
     * @var AbstractBillingCycle[]
9
     */
10
    protected array $billingCycles = [];
11
12 4
    public function addBillingCycle(AbstractBillingCycle $billingCycle)
13
    {
14 4
        $this->billingCycles[] = $billingCycle;
15 4
    }
16
17
    /**
18
     * @return AbstractBillingCycle[]
19
     */
20 3
    public function getBillingCycles(): array
21
    {
22 3
        return $this->billingCycles;
23
    }
24
25 4
    public function toArray(): array
26
    {
27 4
        $array = [];
28
29 4
        foreach ($this->billingCycles as $billingCycle) {
30 4
            $array[] = $billingCycle->toArray();
31
        }
32
33 4
        return $array;
34
    }
35
}
36