mirror of
https://github.com/archtechx/money.git
synced 2025-12-12 11:24:03 +00:00
fix: import exception
This commit is contained in:
parent
2a60b7b3d8
commit
34740e66a6
1 changed files with 2 additions and 1 deletions
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||||
namespace ArchTech\Money;
|
namespace ArchTech\Money;
|
||||||
|
|
||||||
use ArchTech\Money\Exceptions\CannotExtractCurrencyException;
|
use ArchTech\Money\Exceptions\CannotExtractCurrencyException;
|
||||||
|
use Exception;
|
||||||
|
|
||||||
class PriceFormatter
|
class PriceFormatter
|
||||||
{
|
{
|
||||||
|
|
@ -38,7 +39,7 @@ class PriceFormatter
|
||||||
$removeNonDigits = preg_replace('/[^\d' . preg_quote($currency->decimalSeparator()) . ']/', '', $formatted);
|
$removeNonDigits = preg_replace('/[^\d' . preg_quote($currency->decimalSeparator()) . ']/', '', $formatted);
|
||||||
|
|
||||||
if (! is_string($removeNonDigits)) {
|
if (! is_string($removeNonDigits)) {
|
||||||
throw new \Exception('The formatted string could not be resolved to a valid number.');
|
throw new Exception('The formatted string could not be resolved to a valid number.');
|
||||||
}
|
}
|
||||||
|
|
||||||
return (float) str_replace($currency->decimalSeparator(), '.', $removeNonDigits);
|
return (float) str_replace($currency->decimalSeparator(), '.', $removeNonDigits);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue