Total Complexity | 7 |
Total Lines | 70 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
7 | final class Account |
||
8 | { |
||
9 | /** |
||
10 | * @var string |
||
11 | */ |
||
12 | private $id; |
||
13 | |||
14 | /** |
||
15 | * @var int |
||
16 | */ |
||
17 | private $balance; |
||
18 | |||
19 | /** |
||
20 | * @var int |
||
21 | */ |
||
22 | private $creditLimit; |
||
23 | |||
24 | /** |
||
25 | * @var int |
||
26 | */ |
||
27 | private $currencyCode; |
||
28 | |||
29 | /** |
||
30 | * @var string |
||
31 | */ |
||
32 | private $cashbackType; |
||
33 | |||
34 | public function __construct(string $id, int $balance, int $creditLimit, int $currencyCode, string $cashbackType) |
||
35 | { |
||
36 | $this->id = $id; |
||
37 | $this->balance = $balance; |
||
38 | $this->creditLimit = $creditLimit; |
||
39 | $this->currencyCode = $currencyCode; |
||
40 | $this->cashbackType = $cashbackType; |
||
41 | } |
||
42 | |||
43 | public static function fromResponse(array $data): self |
||
44 | { |
||
45 | return new self( |
||
46 | $data['id'], |
||
47 | $data['balance'], |
||
48 | $data['creditLimit'], |
||
49 | $data['currencyCode'], |
||
50 | $data['cashbackType'] |
||
51 | ); |
||
52 | } |
||
53 | |||
54 | public function id(): string |
||
57 | } |
||
58 | |||
59 | public function balance(): int |
||
60 | { |
||
61 | return $this->balance; |
||
62 | } |
||
63 | |||
64 | public function creditLimit(): int |
||
67 | } |
||
68 | |||
69 | public function currencyCode(): int |
||
70 | { |
||
71 | return $this->currencyCode; |
||
72 | } |
||
73 | |||
74 | public function cashbackType(): string |
||
77 | } |
||
78 | } |
||
79 |