Passed
Push — feature/refactor-subscription-... ( 326c18 )
by Darío
03:04
created

Frequency::setFrequency()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 1
c 1
b 0
f 1
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace PaymentGateway\PayPalSdk\Subscriptions;
4
5
class Frequency
6
{
7
    protected string $frequency;
8
    protected int $quantity;
9
10 6
    public function __construct(string $frequency, int $quantity)
11
    {
12 6
        $this->frequency = $frequency;
13 6
        $this->quantity = $quantity;
14 6
    }
15
16 1
    public function getFrequency(): string
17
    {
18 1
        return $this->frequency;
19
    }
20
21 1
    public function setFrequency(string $frequency): void
22
    {
23 1
        $this->frequency = $frequency;
24 1
    }
25
26 4
    public function getQuantity(): int
27
    {
28 4
        return $this->quantity;
29
    }
30
31 1
    public function setQuantity(int $quantity): void
32
    {
33 1
        $this->quantity = $quantity;
34 1
    }
35
36 5
    public function toArray(): array
37
    {
38
        return [
39 5
            'interval_unit' => $this->frequency,
40 5
            'interval_count' => $this->quantity,
41
        ];
42
    }
43
}
44