private function _validateInput($input, $base, $checkDomain = false)
    {
        if (!array_key_exists($base, self::$allowedBases)) {
            throw new InvalidArgumentException(sprintf(
                'Type must be one of "%s".',
                implode(', ', array_keys(self::$allowedBases))
            ));
        }

        if (preg_match(self::$allowedBases[$base], $input) !== 1) {
            throw new InvalidArgumentException(sprintf(
                'Input data "%s" does not match pattern "%s".',
                $input,
                self::$allowedBases[$base]
            ));
        }

        if ($checkDomain) {
            $compare = gmp_init($input, $base);

            if (gmp_cmp($this->minValue, $compare) > 0 || gmp_cmp($compare, $this->maxValue) > 0) {
                throw new InvalidArgumentException(sprintf(
                    'Input value "%d" is out of domain range "%d - %d".',
                    gmp_strval($compare, 10),
                    $this->minValue,
                    $this->maxValue
                ));
            }
        }
    }
private function _validateInput($input, $base, $checkDomain = false)
    {
        if (!array_key_exists($base, self::$allowedBases)) {
            throw new InvalidArgumentException(sprintf(
                'Type must be one of "%s".',
                implode(', ', array_keys(self::$allowedBases))
            ));
        }

        if (preg_match(self::$allowedBases[$base], $input) !== 1) {
            throw new InvalidArgumentException(sprintf(
                'Input data "%s" does not match pattern "%s".',
                $input,
                self::$allowedBases[$base]
            ));
        }

        if ($checkDomain) {
            $compare = gmp_init($input, $base);

            if (gmp_cmp($this->minValue, $compare) > 0 || gmp_cmp($compare, $this->maxValue) > 0) {
                throw new InvalidArgumentException(sprintf(
                    'Input value "%d" is out of domain range "%d - %d".',
                    gmp_strval($compare, 10),
                    $this->minValue,
                    $this->maxValue
                ));
            }
        }
    }
private function _validateInput ( $ input , $ base , $ checkDomain = false ) { if ( ! array_key_exists ( $ base , self :: $ allowedBases ) ) { throw new InvalidArgumentException ( sprintf ( 'Type must be one of "%s".' , implode ( ', ' , array_keys ( self :: $ allowedBases ) ) ) ) ; } if ( preg_match ( self :: $ allowedBases [ $ base ] , $ input ) !== 1 ) { throw new InvalidArgumentException ( sprintf ( 'Input data "%s" does not match pattern "%s".' , $ input , self :: $ allowedBases [ $ base ] ) ) ; } if ( $ checkDomain ) { $ compare = gmp_init ( $ input , $ base ) ; if ( gmp_cmp ( $ this -> minValue , $ compare ) > 0 || gmp_cmp ( $ compare , $ this -> maxValue ) > 0 ) { throw new InvalidArgumentException ( sprintf ( 'Input value "%d" is out of domain range "%d - %d".' , gmp_strval ( $ compare , 10 ) , $ this -> minValue , $ this -> maxValue ) ) ; } } }
Validates input data.

@param string $input
@param string $base
@param bool   $checkDomain Should check if input is in domain?

@throws InvalidArgumentException If provided invalid type.
Validates input data .