| Total Complexity | 5 |
| Total Lines | 45 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | final class CurrencyConversionException extends RuntimeException |
||
| 12 | { |
||
| 13 | /** @var int */ |
||
| 14 | private $amount; |
||
| 15 | |||
| 16 | /** @var string */ |
||
| 17 | private $sourceCurrency; |
||
| 18 | |||
| 19 | /** @var string */ |
||
| 20 | private $targetCurrency; |
||
| 21 | |||
| 22 | /** @var array */ |
||
| 23 | private $conversionContext; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @throws StringsException |
||
| 27 | */ |
||
| 28 | public function __construct(int $amount, string $sourceCurrency, string $targetCurrency, array $conversionContext = []) |
||
| 29 | { |
||
| 30 | parent::__construct(sprintf('The source, %s %d, could not be converted to %s', $sourceCurrency, $amount, $targetCurrency)); |
||
| 31 | |||
| 32 | $this->amount = $amount; |
||
| 33 | $this->sourceCurrency = $sourceCurrency; |
||
| 34 | $this->targetCurrency = $targetCurrency; |
||
| 35 | $this->conversionContext = $conversionContext; |
||
| 36 | } |
||
| 37 | |||
| 38 | public function getAmount(): int |
||
| 39 | { |
||
| 40 | return $this->amount; |
||
| 41 | } |
||
| 42 | |||
| 43 | public function getSourceCurrency(): string |
||
| 44 | { |
||
| 45 | return $this->sourceCurrency; |
||
| 46 | } |
||
| 47 | |||
| 48 | public function getTargetCurrency(): string |
||
| 49 | { |
||
| 50 | return $this->targetCurrency; |
||
| 51 | } |
||
| 52 | |||
| 53 | public function getConversionContext(): array |
||
| 56 | } |
||
| 57 | } |
||
| 58 |