CoreFiles by mySites.guru
NumberFormatException.php35 lines, 799 bytes, from Joomla_4.0.2-Stable-Full_Package.zip
Raw History Compare with 4.0.1
md5
b59de5aeba172b532e85cfc5d3d6662c
sha1
c96e82b51c7d434b4204abec268c8bdd21f9814d
sha256
912be9d0b83429dd1279948931bbb0aafa7331a749a56ff7b7dd6abe679c8ebf
<?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));
    }
}

The same content is in 128 releases, Joomla 4.0.0-beta4 to 4.4.14. See them all, or every version of this file.