| Total Complexity | 6 |
| Total Lines | 51 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | class CurrencyFactory |
||
| 18 | { |
||
| 19 | /** @var CurrencyInterface[] */ |
||
| 20 | private array $currencies = []; |
||
| 21 | |||
| 22 | public function __construct() |
||
| 23 | { |
||
| 24 | $this->register(new BRL()); |
||
| 25 | $this->register(new USD()); |
||
| 26 | $this->register(new EUR()); |
||
| 27 | } |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @param CurrencyInterface $currency |
||
| 31 | * @return void |
||
| 32 | */ |
||
| 33 | public function register(CurrencyInterface $currency): void |
||
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @param string $currency |
||
| 40 | * @return CurrencyInterface |
||
| 41 | */ |
||
| 42 | public static function get(string $currency): CurrencyInterface |
||
| 45 | } |
||
| 46 | |||
| 47 | /** |
||
| 48 | * @param string $code |
||
| 49 | * @return CurrencyInterface |
||
| 50 | */ |
||
| 51 | public function create(string $code): CurrencyInterface |
||
| 60 | } |
||
| 61 | |||
| 62 | /** |
||
| 63 | * @return array |
||
| 64 | */ |
||
| 65 | public function getAvailableCurrencies(): array |
||
| 70 |