public static function fromString(string $number, $base = null)
    {
        // Temporarily split the sign from the operand for easier matching. We will reattach it later.
        $sign   = 0 === strpos($number, '-') ? '-' : '';
        $number = ltrim($number, '-+');

        if (null === $base) {
            if (preg_match('#^(?:([1-9])\.)?([0-9]+)[eE]\+?([0-9]+)$#', $number, $matches)) {
                if (!empty($matches[1])) {
                    if ($matches[3] < strlen($matches[2])) {
                        throw new \InvalidArgumentException('Failed to create BigInt - malformed scientific notation of the number.');
                    }
                } else {
                    $matches[1] = '';
                }
                $number = str_pad(($matches[1] . $matches[2]), ($matches[3] + 1), '0', STR_PAD_RIGHT);
            } else {
                $base = 0;
            }
        }

        return new static(gmp_init($sign.$number, $base));
    }