Total Complexity | 8 |
Total Lines | 122 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
13 | class Currency |
||
14 | { |
||
15 | |||
16 | /** |
||
17 | * Currency name. |
||
18 | * |
||
19 | * @var string |
||
20 | */ |
||
21 | private $currency; |
||
22 | |||
23 | /** |
||
24 | * Currency code. |
||
25 | * |
||
26 | * @var string |
||
27 | */ |
||
28 | private $code; |
||
29 | |||
30 | /** |
||
31 | * Currency number. |
||
32 | * |
||
33 | * @var int |
||
34 | */ |
||
35 | private $num; |
||
36 | |||
37 | /** |
||
38 | * Sets the input values. |
||
39 | * |
||
40 | * @param string $currency Currency name. |
||
41 | * @param string $code Currency code. |
||
42 | * @param int $num Currency number. |
||
43 | */ |
||
44 | 2 | public function __construct($currency, $code, $num) |
|
45 | { |
||
46 | $this |
||
47 | 2 | ->setCurrency($currency) |
|
48 | 2 | ->setCode($code) |
|
49 | 2 | ->setNum($num); |
|
50 | 2 | } |
|
51 | |||
52 | /** |
||
53 | * Sets currency name. |
||
54 | * Returns the current object. |
||
55 | * |
||
56 | * @param string $currency Currency name. |
||
57 | * |
||
58 | * @return self |
||
59 | */ |
||
60 | 2 | private function setCurrency($currency) |
|
61 | { |
||
62 | 2 | $this->currency = $currency; |
|
63 | 2 | return $this; |
|
64 | } |
||
65 | |||
66 | /** |
||
67 | * Sets currency code. |
||
68 | * Returns the current object. |
||
69 | * |
||
70 | * @param string $code Currency code. |
||
71 | * |
||
72 | * @return self |
||
73 | */ |
||
74 | 2 | private function setCode($code) |
|
75 | { |
||
76 | 2 | $this->code = $code; |
|
77 | 2 | return $this; |
|
78 | } |
||
79 | |||
80 | /** |
||
81 | * Sets currency number. |
||
82 | * Returns the current object. |
||
83 | * |
||
84 | * @param int $num Currency number. |
||
85 | * |
||
86 | * @return self |
||
87 | */ |
||
88 | 2 | private function setNum($num) |
|
89 | { |
||
90 | 2 | $this->num = $num; |
|
91 | 2 | return $this; |
|
92 | } |
||
93 | |||
94 | /** |
||
95 | * Gets currency name. |
||
96 | * |
||
97 | * @return string |
||
98 | */ |
||
99 | 2 | public function getCurrency() |
|
102 | } |
||
103 | |||
104 | /** |
||
105 | * Gets currency code. |
||
106 | * |
||
107 | * @return string |
||
108 | */ |
||
109 | 2 | public function getCode() |
|
110 | { |
||
111 | 2 | return $this->code; |
|
112 | } |
||
113 | |||
114 | /** |
||
115 | * Gets currency number. |
||
116 | * |
||
117 | * @return int |
||
118 | */ |
||
119 | 2 | public function getNum() |
|
120 | { |
||
121 | 2 | return $this->num; |
|
122 | } |
||
123 | |||
124 | /** |
||
125 | * Gets currency data as an associative array. |
||
126 | * |
||
127 | * @return array |
||
128 | */ |
||
129 | 2 | public function toArray() |
|
135 | ]; |
||
136 | } |
||
137 | } |
||
138 |