Asserts if the given value is a maybe int

@param  mixed  $value
@param  string $varName
@return int|null
@throws InvalidTypeException

@SuppressWarnings("PHPMD.StaticAccess")
190442
public static function assert($value, $varName) {
        return !is_int($value) && $value !== null ? Exceptions::InvalidTypeException('MaybeInt', $varName, $value) : $value;
    }
971952
public static Integer isInteger(String value) {
		Validate.notNull(value);
		Validate.notEmpty(value);
		Integer intValue = null;
		try{
			intValue = 	Integer.parseInt(value);
		} catch(NumberFormatException e){
			throw new TypeException("Integer");
		}
		return intValue;
	}
1123535
private function maybe($value, $varList) {
        switch(func_num_args()){
            case 0:
                return false;
            case 1:
                return !!$value;
            case 2:
                if (is_array($varList)) {
                    return array_search($value, $varList, true) !== false;
                }
                return $value == $varList;
            default:
                $varList = func_get_args();
                $value = array_shift($varList);
                return $this->maybe($value, $varList);
        }
    }
1226433
public static function type_integer($var, array $settings)
	{
		if (is_array($var) or is_object($var))
		{
			throw new InvalidContentType('Array or object could not be converted to integer.');
		}

		if ((array_key_exists('min', $settings) and $var < intval($settings['min']))
			or (array_key_exists('max', $settings) and $var > intval($settings['max'])))
		{
			throw new InvalidContentType('Integer value outside of range: '.$var);
		}

		return intval($var);
	}
334732
public static function IS_NUMBER($value = NULL) {
		$value		= self::flattenSingleValue($value);

		if (is_string($value)) {
			return False;
		}
		return is_numeric($value);
	}
309192
private function checkType($type, $value)
    {        
        switch($type)
        {
            case 'bool':
            case 'boolean':
                $codeException = (!is_bool($value)) ? 1 : 0;
                break;
            case 'int':
            case 'integer':
                $codeException = (!is_int($value)) ? 1 : 0;
                break;
            case 'string':
                $codeException = (!is_string($value)) ? 1 : 0;
                break;
            case 'not_resource':
                $codeException = (is_resource($value)) ? 2 : 0;
                break;
            default :
                $codeException = 3;
                break;
        }
        
        return $codeException;
    }
1142207
protected function setValue($value)
    {
        if (! is_bool($value)) {
            throw InvalidTypeException::fromMessageAndPrototype("Value must be a boolean", static::prototype());
        }

        $this->value = $value;
    }
1235869
private function matchType(string $formalType, $value)
    {
        // Parameter without type-hinting returns as is
        if ($formalType === '') {
            return $value;
        }

        if ($this->isType($formalType, $value)) {
            return $value;
        }

        throw new InvalidParamsException('Type hint failed');
    }
610735
private function isInt(string $value): bool
    {
        return \is_numeric($value) && (float)\round($value, 0) === (float)$value;
    }
524247
protected function isNotNull($value)
    {
        if (is_null($value) === true || empty($value) === true) {
            throw new ExceptionFactory('DataType', [$value, 'string']);
        }

        return true;
    }
1337035
public function getNumeric($varname)
    {
        $value = $this->getString($varname);
        return is_numeric($value) ? $value + 0 : null;
    }
488009
protected function checkType($value)
    {
        if (RuntimeUtils::isQtiScalarDatatypeCompliant($value)) {
            return;
        } else {
            $value = (gettype($value) === 'object') ? get_class($value) : $value;
            $msg = "The OperandsCollection only accepts QTI Runtime compliant values, '" . $value . "' given.";
            throw new InvalidArgumentException($msg);
        }
    }
928147
public static function getInteger(&$var, $values = null)
    {
        if (is_string($var) && ctype_digit($var)) {
            $var = (int)$var;
        }
        if (!is_int($var)) {
            return 0;
        }
        if ($values !== null) {
            return in_array($var, $values, true) ? $var : $values[0];
        }

        return $var;
    }
234711
function checkType($value)
    {
        if( $this->type !== null ) {
            // check type constraints
            if( $this->isTypeInteger() ) {
                if( ! is_numeric($value) )
                    throw new NonNumericException;
                $value = (int) $value;
            }
        }
        return $value;
    }
1077635
protected function setValue($value)
    {
        if (!is_int($value)) {
            throw InvalidTypeException::fromMessageAndPrototype("Value must be an integer", static::prototype());
        }
        $this->value = $value;
    }
468576
private function getNumberValueOrNull($value)
    {
        if (!is_scalar($value) || is_bool($value) || (string) $value === '' || !is_numeric((string) $value)) {
            return null;
        }

        if ($this->isFloat() === true) {
            return is_float($value) ? $value : (float) $value;
        }

        return is_int($value) ? $value : (int) $value;
    }
598741
protected function checkType($value)
    {
        if (is_string($value) !== true) {
            $msg = "The Identifier Datatype only accepts to store identifier values.";
            throw new InvalidArgumentException($msg);
        } elseif ($value === '') {
            $msg = "The Identifier Datatype do not accept empty strings as valid identifiers.";
            throw new InvalidArgumentException($msg);
        }
    }