Total Complexity | 10 |
Total Lines | 115 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | class FiatRateObject |
||
12 | { |
||
13 | /** |
||
14 | * @var string |
||
15 | */ |
||
16 | private $from; |
||
17 | /** |
||
18 | * @var string |
||
19 | */ |
||
20 | private $to; |
||
21 | /** |
||
22 | * @var float|int |
||
23 | */ |
||
24 | private $rate; |
||
25 | /** |
||
26 | * @var string |
||
27 | */ |
||
28 | private $time; |
||
29 | |||
30 | /** |
||
31 | * FiatRateObject constructor. |
||
32 | * @param string $from |
||
33 | * @param string $to |
||
34 | * @param float|int $rate |
||
35 | * @param string $time |
||
36 | */ |
||
37 | 81 | public function __construct(string $from, string $to, $rate, string $time) |
|
38 | { |
||
39 | 81 | $this->setFrom($from); |
|
40 | 81 | $this->setTo($to); |
|
41 | 81 | $this->setRate($rate); |
|
42 | 81 | $this->setTime($time); |
|
43 | 81 | } |
|
44 | |||
45 | /** |
||
46 | * @return string |
||
47 | */ |
||
48 | 12 | public function getFrom(): string |
|
51 | } |
||
52 | |||
53 | /** |
||
54 | * @param string $from |
||
55 | */ |
||
56 | 81 | public function setFrom(string $from) |
|
57 | { |
||
58 | 81 | $this->from = $from; |
|
59 | 81 | } |
|
60 | |||
61 | /** |
||
62 | * @return string |
||
63 | */ |
||
64 | 21 | public function getTo(): string |
|
65 | { |
||
66 | 21 | return $this->to; |
|
67 | } |
||
68 | |||
69 | /** |
||
70 | * @param string $to |
||
71 | */ |
||
72 | 81 | public function setTo(string $to) |
|
73 | { |
||
74 | 81 | $this->to = $to; |
|
75 | 81 | } |
|
76 | |||
77 | /** |
||
78 | * @return float|int |
||
79 | */ |
||
80 | 6 | public function getRate() |
|
81 | { |
||
82 | 6 | return $this->rate; |
|
83 | } |
||
84 | |||
85 | /** |
||
86 | * @param float|int $rate |
||
87 | */ |
||
88 | 81 | public function setRate($rate) |
|
89 | { |
||
90 | 81 | TypeValidator::isNum($rate); |
|
91 | |||
92 | 81 | $this->rate = $rate; |
|
93 | 81 | } |
|
94 | |||
95 | /** |
||
96 | * @return string |
||
97 | */ |
||
98 | 3 | public function getTime(): string |
|
101 | } |
||
102 | |||
103 | /** |
||
104 | * @param string $time |
||
105 | */ |
||
106 | 81 | public function setTime(string $time) |
|
107 | { |
||
108 | 81 | $this->time = $time; |
|
109 | 81 | } |
|
110 | |||
111 | /** |
||
112 | * @param $amount |
||
113 | * @return ConverterResultObject |
||
114 | */ |
||
115 | 42 | public function convert($amount): ConverterResultObject |
|
126 | } |
||
127 | } |
||
128 |