1
0
Fork 0
mirror of https://github.com/archtechx/money.git synced 2025-12-12 19:34:02 +00:00

fix: import exception

This commit is contained in:
Gaurav 2022-03-31 10:09:40 +05:30
parent 2a60b7b3d8
commit 34740e66a6

View file

@ -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);