| Total Complexity | 6 |
| Total Lines | 70 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 5 | class MoneyFormatter |
||
| 6 | { |
||
| 7 | |||
| 8 | /** |
||
| 9 | * The current currency. |
||
| 10 | * |
||
| 11 | * @var string |
||
| 12 | */ |
||
| 13 | protected $currency; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * The current locale. |
||
| 17 | * |
||
| 18 | * @var string |
||
| 19 | */ |
||
| 20 | protected $locale; |
||
| 21 | |||
| 22 | public function __construct(string $currency = 'TRY', string $locale = 'tr_TR') |
||
| 23 | { |
||
| 24 | $this->currency = $currency; |
||
| 25 | $this->locale = $locale; |
||
| 26 | } |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Gets the amount formatted according the currency and locale |
||
| 30 | * @param $amount The amount in cents(!) |
||
|
|
|||
| 31 | * @return String The current locale |
||
| 32 | */ |
||
| 33 | public function format($amount) |
||
| 34 | { |
||
| 35 | $formatter = new \NumberFormatter($this->locale, \NumberFormatter::CURRENCY); |
||
| 36 | return (string) $formatter->formatCurrency($amount / 100, $this->currency); |
||
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * Gets the current locale |
||
| 41 | * @return String The current locale |
||
| 42 | */ |
||
| 43 | public function getLocale() : string |
||
| 44 | { |
||
| 45 | return (string) $this->locale; |
||
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * Sets the current locale |
||
| 50 | * @param $locale The locale (i.e. 'nl_NL') |
||
| 51 | * @return Void |
||
| 52 | */ |
||
| 53 | public function setLocale(string $locale) |
||
| 56 | } |
||
| 57 | |||
| 58 | /** |
||
| 59 | * Gets the current currency |
||
| 60 | * @return String The current currency |
||
| 61 | */ |
||
| 62 | public function getCurrency() |
||
| 63 | { |
||
| 64 | return (string) $this->currency; |
||
| 65 | } |
||
| 66 | |||
| 67 | /** |
||
| 68 | * Sets the current currency |
||
| 69 | * @param $currency The currency (i.e. 'EUR') |
||
| 70 | * @return Void |
||
| 71 | */ |
||
| 72 | public function setCurrency(string $currency) |
||
| 75 | } |
||
| 76 | } |
||
| 77 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths