Whether a given $value is compliant with a given $baseType.

@param int $baseType A value from the BaseType enumeration.
@param mixed $value A value.
@return boolean
519676
static public function isBaseTypeCompliant($baseType, $value)
    {
        if ($value === null) {
            return true; // A value can always be null.
        } elseif ($value instanceof QtiDatatype && $baseType === $value->getBaseType()) {
            return true;
        } else {
            return false;
        }
    }
187225
protected function castToType($value, string $type)
    {
        $platform = $this->connection->getDatabasePlatform();

        return Type::getType($type)->convertToDatabaseValue($value, $platform);
    }
587218
public function setBaseType($base_type)
    {
        $base_type = strtoupper($base_type);
        if (!in_array($base_type, self::getBaseTypes())) {
            throw new \InvalidArgumentException(sprintf('The "%s" base type is not a valid base type.', $base_type));
        }
        $this->base_type = $base_type;
        return $this;
    }
286305
public function accept(int $type, $value = null) : bool
    {
        if ($this->getCurrentToken()->getType() === $type) {
            if ($value) {
                if ($this->getCurrentToken()->getValue() === $value) {
                    return true;
                }

                return false;
            }

            return true;
        }

        return false;
    }
985733
protected function checkValueStructure(BaseValue $value)
    {
        if (!$value->authors instanceof AuthorCollection) {
            throw new InvalidArgumentType(
                '$value->authors',
                AuthorCollection::class,
                $value->authors
            );
        }
    }
1124827
protected function checkType($value)
    {
        if (is_int($value) !== true && is_string($value) !== true) {
            $msg = "The IntOrIdentifier Datatype only accepts to store identifier and integer values.";
            throw new InvalidArgumentException($msg);
        }
    }
985067
private function validateType($type, $value): bool
    {
        if (substr($type, 0, 1) === '[' && substr($type, -1) === ']') { // Array of a specified type?
            if ($this->validateType('array', $value) === false) {
                return false;
            }
            $itemType = substr($type, 1, -1);
            foreach ($value as $i => $item) {
                if ($this->validateType($itemType, $item) === false) {
                    return false;
                }
            }
            return true;
        }

        if (is_subclass_of($type, AbstractAnnotation::class)) {
            $type = 'object';
        }

        return $this->validateDefaultTypes($type, $value);
    }
793612
protected function checkValueStructure(BaseValue $value)
    {
        parent::checkValueStructure($value);

        if (!is_bool($value->hasController)) {
            throw new InvalidArgumentType(
                '$value->hasController',
                'bool',
                $value->hasController
            );
        }
        if (!is_bool($value->autoplay)) {
            throw new InvalidArgumentType(
                '$value->autoplay',
                'bool',
                $value->autoplay
            );
        }
        if (!is_bool($value->loop)) {
            throw new InvalidArgumentType(
                '$value->loop',
                'bool',
                $value->loop
            );
        }

        if (!is_int($value->height)) {
            throw new InvalidArgumentType(
                '$value->height',
                'int',
                $value->height
            );
        }
        if (!is_int($value->width)) {
            throw new InvalidArgumentType(
                '$value->width',
                'int',
                $value->width
            );
        }
    }
395538
protected function _checkType( $value )
	{
		switch( $value )
		{
			case MShop_Order_Item_Base_Address_Abstract::TYPE_DELIVERY:
			case MShop_Order_Item_Base_Address_Abstract::TYPE_PAYMENT:
				return;
			default:
				throw new MShop_Order_Exception( sprintf( 'Service of type "%1$s" not available', $value ) );
		}
	}
998198
public static function setType($value, $type, $nullable = TRUE)
	{
		if (!$nullable || NULL !== $value) {
			settype($value, $type);
		}

		return $value;
	}
5120
private function isValidType($value): bool
    {
        if ($this->type instanceof DataType) {
            return $this->type->isTheTypeOf($value);
        }

        return true;
    }
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;
    }
1066911
protected function isArrayType($columnType)
    {
        if (!\preg_match('/^([a-z]+)(?:\[\]){1,}$/', $columnType, $matches)) {
            return false;
        }

        $baseType = $matches[1];

        return \in_array($baseType, $this->getColumnTypes(), true);
    }
864673
protected function checkValueStructure(BaseValue $value)
    {
        if (!is_array($value->destinationContentIds)) {
            throw new InvalidArgumentType(
                '$value->destinationContentIds',
                'array',
                $value->destinationContentIds
            );
        }

        foreach ($value->destinationContentIds as $key => $destinationContentId) {
            if (!is_int($destinationContentId) && !is_string($destinationContentId)) {
                throw new InvalidArgumentType(
                    "\$value->destinationContentIds[$key]",
                    'string|int',
                    $destinationContentId
                );
            }
        }
    }
981248
protected function checkValueStructure(BaseValue $value)
    {
        if (null !== $value->link && !is_string($value->link)) {
            throw new InvalidArgumentType(
                '$value->link',
                'string',
                $value->link
            );
        }

        if (null !== $value->text && !is_string($value->text)) {
            throw new InvalidArgumentType(
                '$value->text',
                'string',
                $value->text
            );
        }
    }
113635
public function isValueValid($value) {
		return $value instanceof Type\MonetaryAmountType || $value instanceof DataType\NumberType || $value instanceof Type\PriceSpecificationType;
	}
843711
private static function isSimpleType($value, string $type): ?bool
    {
        switch ($type) {
            case 'array':
                return static::isArray($value);
                break;
            case 'object':
                return static::isObject($value);
                break;
            case 'bool':
                return static::isBool($value);
                break;
            case 'int':
                return static::isInt($value);
                break;
            case 'float':
                return static::isFloat($value);
                break;
            case 'string':
                return static::isString($value);
                break;
            case 'callable':
                return static::isCallable($value);
                break;
            default:
                break;
        }

        return null;
    }