CoreFiles by mySites.guru
NumberFormatException.php33 lines, 755 bytes, from Joomla_5.0.0-alpha1-Alpha-Full_Package.zip
Raw History Compare with 4.4.0-alpha4
md5
305340952f32512f7c2fb70fca0a1c6a
sha1
3e7672ab8c3432ff712a8c079420133c898cdb36
sha256
9b07e6ca9c4667d04a731e1b68cf74bc75cadfe8cc1017fba6a38cd6d4b93096
<?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.
     *
     * @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 22 releases, Joomla 5.0.0-alpha1 to 5.1.0-alpha4. See them all, or every version of this file.