diff options
author | Mario <mario@mariovavti.com> | 2020-11-27 08:04:00 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2020-11-27 08:04:00 +0000 |
commit | f4bb7bcbff3770387c2fecfa91ce4a60b916a474 (patch) | |
tree | ea007e664d435f1f3d63c87bfe1600484d2bd46c /vendor/brick/math/src/Exception/NumberFormatException.php | |
parent | 07e5b8295ea9d342f66d8119d88bd58124b548e6 (diff) | |
download | volse-hubzilla-f4bb7bcbff3770387c2fecfa91ce4a60b916a474.tar.gz volse-hubzilla-f4bb7bcbff3770387c2fecfa91ce4a60b916a474.tar.bz2 volse-hubzilla-f4bb7bcbff3770387c2fecfa91ce4a60b916a474.zip |
update composer libs
Diffstat (limited to 'vendor/brick/math/src/Exception/NumberFormatException.php')
-rw-r--r-- | vendor/brick/math/src/Exception/NumberFormatException.php | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/vendor/brick/math/src/Exception/NumberFormatException.php b/vendor/brick/math/src/Exception/NumberFormatException.php new file mode 100644 index 000000000..2fd0be73a --- /dev/null +++ b/vendor/brick/math/src/Exception/NumberFormatException.php @@ -0,0 +1,35 @@ +<?php + +declare(strict_types=1); + +namespace Brick\Math\Exception; + +/** + * Exception thrown when attempting to create a number from a string with an invalid format. + */ +class NumberFormatException extends MathException +{ + /** + * @param string $char The failing character. + * + * @return NumberFormatException + * + * @psalm-pure + */ + public static function charNotInAlphabet(string $char) : self + { + $ord = \ord($char); + + if ($ord < 32 || $ord > 126) { + $char = \strtoupper(\dechex($ord)); + + if ($ord < 10) { + $char = '0' . $char; + } + } else { + $char = '"' . $char . '"'; + } + + return new self(sprintf('Char %s is not a valid character in the given alphabet.', $char)); + } +} |