1 | <?php namespace Arcanedev\Currencies; |
||
13 | class CurrencyManager implements CurrencyManagerContract |
||
14 | { |
||
15 | /* ------------------------------------------------------------------------------------------------ |
||
16 | | Properties |
||
17 | | ------------------------------------------------------------------------------------------------ |
||
18 | */ |
||
19 | /** |
||
20 | * Default currency. |
||
21 | * |
||
22 | * @var string |
||
23 | */ |
||
24 | protected $default; |
||
25 | |||
26 | /** |
||
27 | * Supported currencies. |
||
28 | * |
||
29 | * @var array |
||
30 | */ |
||
31 | protected $supported = []; |
||
32 | |||
33 | /** |
||
34 | * Non ISO Currencies included. |
||
35 | * |
||
36 | * @var bool |
||
37 | */ |
||
38 | protected $nonIsoIncluded = false; |
||
39 | |||
40 | /** |
||
41 | * The currencies collection. |
||
42 | * |
||
43 | * @var \Arcanedev\Currencies\Entities\CurrencyCollection |
||
44 | */ |
||
45 | protected $currencies; |
||
46 | |||
47 | /* ------------------------------------------------------------------------------------------------ |
||
48 | | Constructor |
||
49 | | ------------------------------------------------------------------------------------------------ |
||
50 | */ |
||
51 | /** |
||
52 | * CurrencyManager constructor. |
||
53 | * |
||
54 | * @param array $configs |
||
55 | */ |
||
56 | 432 | public function __construct(array $configs) |
|
63 | |||
64 | /* ------------------------------------------------------------------------------------------------ |
||
65 | | Getters & Setters |
||
66 | | ------------------------------------------------------------------------------------------------ |
||
67 | */ |
||
68 | /** |
||
69 | * Get the default currency iso code. |
||
70 | * |
||
71 | * @return string |
||
72 | */ |
||
73 | 12 | public function getDefault() |
|
77 | |||
78 | /** |
||
79 | * Get the default currency entity. |
||
80 | * |
||
81 | * @return \Arcanedev\Currencies\Contracts\Entities\Currency |
||
82 | */ |
||
83 | 12 | public function getDefaultCurrency() |
|
87 | |||
88 | /** |
||
89 | * Get supported currencies (iso codes). |
||
90 | * |
||
91 | * @return array |
||
92 | */ |
||
93 | 24 | public function getSupported() |
|
97 | |||
98 | /** |
||
99 | * Get the currencies collection. |
||
100 | * |
||
101 | * @return \Arcanedev\Currencies\Entities\CurrencyCollection |
||
102 | */ |
||
103 | 432 | public function currencies() |
|
107 | |||
108 | /* ------------------------------------------------------------------------------------------------ |
||
109 | | Main Functions |
||
110 | | ------------------------------------------------------------------------------------------------ |
||
111 | */ |
||
112 | /** |
||
113 | * Load the currencies. |
||
114 | * |
||
115 | * @param array $currencies |
||
116 | * |
||
117 | * @return self |
||
118 | */ |
||
119 | 432 | public function load(array $currencies) |
|
125 | |||
126 | /** |
||
127 | * Get a currency from the collection by iso code. |
||
128 | * |
||
129 | * @param string $iso |
||
130 | * @param mixed|null $default |
||
131 | * |
||
132 | * @return \Arcanedev\Currencies\Entities\Currency |
||
133 | */ |
||
134 | 12 | public function get($iso, $default = null) |
|
138 | |||
139 | /** |
||
140 | * Get a currency or fail if not exists. |
||
141 | * |
||
142 | * @param string $iso |
||
143 | * |
||
144 | * @return \Arcanedev\Currencies\Entities\Currency |
||
145 | * |
||
146 | * @throws \Arcanedev\Currencies\Exceptions\CurrencyNotFoundException |
||
147 | */ |
||
148 | 36 | public function findOrFail($iso) |
|
152 | |||
153 | /** |
||
154 | * Get the supported currencies collection. |
||
155 | * |
||
156 | * @return \Arcanedev\Currencies\Entities\CurrencyCollection |
||
157 | */ |
||
158 | 12 | public function getSupportedCurrencies() |
|
167 | |||
168 | /** |
||
169 | * Format the amount. |
||
170 | * |
||
171 | * @param string $iso |
||
172 | * @param int $amount |
||
173 | * @param int $decimals |
||
174 | * |
||
175 | * @return string |
||
176 | * |
||
177 | * @throws \Arcanedev\Currencies\Exceptions\CurrencyNotFoundException |
||
178 | */ |
||
179 | public function format($iso, $amount, $decimals = 2) |
||
183 | |||
184 | /** |
||
185 | * Get the currency symbol by iso code. |
||
186 | * |
||
187 | * @param string $iso |
||
188 | * |
||
189 | * @return string |
||
190 | */ |
||
191 | 12 | public function symbol($iso) |
|
195 | |||
196 | /* ------------------------------------------------------------------------------------------------ |
||
197 | | Check Functions |
||
198 | | ------------------------------------------------------------------------------------------------ |
||
199 | */ |
||
200 | /** |
||
201 | * Check if non ISO Currencies included. |
||
202 | * |
||
203 | * @return bool |
||
204 | */ |
||
205 | public function isNonIsoIncluded() |
||
209 | } |
||
210 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..