Total Complexity | 3 |
Total Lines | 41 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
9 | final class BalanceReponse |
||
10 | { |
||
11 | /** |
||
12 | * @JMS\Type("float") |
||
13 | * @var float |
||
14 | */ |
||
15 | private $balance; |
||
16 | |||
17 | /** |
||
18 | * @JMS\SerializedName("balance-date") |
||
19 | * @JMS\Type("DateTimeImmutable<'Y-m-d'>") |
||
20 | * @var \DateTimeImmutable |
||
21 | */ |
||
22 | private $date; |
||
23 | |||
24 | /** |
||
25 | * @JMS\SerializedName("work-with-balance") |
||
26 | * @JMS\Type("bool") |
||
27 | * @var bool |
||
28 | */ |
||
29 | private $withBalance; |
||
30 | |||
31 | /** |
||
32 | * @JMS\SerializedName("error-message") |
||
33 | * @JMS\Type("string") |
||
34 | * @var string |
||
35 | */ |
||
36 | private $error; |
||
37 | |||
38 | public function getValue(): float |
||
39 | { |
||
40 | if ($this->withBalance) { |
||
41 | return $this->balance; |
||
42 | } |
||
43 | |||
44 | throw new \Exception($this->error); |
||
45 | } |
||
46 | |||
47 | public function getDate(): \DateTimeImmutable |
||
50 | } |
||
51 | } |
||
52 |