Type check a value.

@param string $typeName
@param mixed $value

@return bool
776629
public function check($typeName, $value)
    {
        switch ($typeName) {
            case static::SPECIAL_NULL:
                return $value === null;
            case static::SPECIAL_RESOURCE:
                return is_resource($value);
            default:
                return false;
        }
    }
855694
public function isValid($value)
    {
        foreach ($this as $type) {
            if ($type->isValid($value)) {
                return true;
            }
        }

        return false;
    }
968680
public function getTypeFromValue($value = null)
    {
        $value = ($value === null ? $this->value : $value);
        return array_search($value, self::$typeList);
    }
685975
protected function checkType(string $type, $value): bool
    {
        switch ($type) {
            case 'array':
                return \is_array($value);

            case 'bool':
            case 'boolean':
                return \is_bool($value);

            case 'callable':
                return \is_callable($value);

            case 'float':
            case 'double':
                return \is_float($value);

            case 'int':
            case 'integer':
                return \is_int($value);

            case 'null':
                return $value === null;

            case 'numeric':
                return \is_numeric($value);

            case 'object':
                return \is_object($value);

            case 'resource':
                return \is_resource($value);

            case 'scalar':
                return \is_scalar($value);

            case 'string':
                return \is_string($value);

            case 'mixed':
                return true;

            default:
                return ($value instanceof $type);
        }
    }
1090729
private function isType(string $type, $value): bool
    {
        switch ($type) {
            case 'int':
                return is_int($value);
            case 'float':
                return is_float($value);
            case 'bool':
                return is_bool($value);
            case 'string':
                return is_string($value);
            case 'array':
                return is_array($value);
            case 'object':
                return is_object($value);
            case 'resource':
                return is_resource($value);
            case 'callable':
                return is_callable($value);
            case 'mixed':
                return true;
            default:
                return $value instanceof $type;
        }
    }
667377
public function isTypeOf($value)
    {
        return isset($this->isTypeOf) ? call_user_func($this->isTypeOf, $value) : NULL;
    }
1104262
public function validate(string $type, $value): bool
    {
        switch ($type) {
            case self::TYPE_NULL:
                return is_null($value);
            case self::TYPE_BOOLEAN:
                return is_bool($value);
            case self::TYPE_INTEGER:
                return is_integer($value);
            case self::TYPE_FLOAT:
                return is_float($value);
            case self::TYPE_STRING:
                return is_string($value);
            case self::TYPE_ARRAY:
                if (!is_array($value)) {
                    return false;
                }
                return $this->isArrayType($value);
            case self::TYPE_OBJECT:
                if (!is_array($value)) {
                    return false;
                }
                return $this->isObjectType($value);
            case self::TYPE_BINARY:
                return is_string($value);
        }

        throw new InvalidValueException("Invalid value type: $type");
    }
604478
public function isValueValid($value) {
		return $value instanceof DataType\NumberType || $value instanceof Type\PriceSpecificationType || $value instanceof DataType\TextType;
	}
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;
    }
1259765
public function isValueValid($value) {
		return $value instanceof Type\CreativeWorkType || $value instanceof Type\HowToSectionType || $value instanceof Type\HowToStepType || $value instanceof DataType\TextType;
	}
719345
protected function typeByName($name, $value, $clear = false)
    {
        return $this->typeBySelectorType('name', $value, $name, $clear);
    }
239392
public function getTypeFromValue($value = null)
    {
        $value = ($value == null ? $this->value : $value);
        return array_search($this->value, self::$statusList);
    }
98001
protected function setValue($value, string $type)
    {
        $this->value = $type !== self::TYPE_CALL
            ? $this->validateValue($value)
            : array_map(function ($value) {
                return $this->validateValue($value);
            }, $value);
    }
1219509
protected static function isValidValue(TypeInterface $type, $value)
    {
        if ($type instanceof NonNullModifier) {
            if (NULL === $value) {
                return FALSE;
            }

            return self::isValidValue($type->getWrappedType(), $value);
        }

        if ($value === NULL) {
            return TRUE;
        }

        if ($type instanceof ListModifier) {
            $itemType = $type->getWrappedType();
            if (is_array($value)) {
                foreach ($value as $item) {
                    if (!self::isValidValue($itemType, $item)) {
                        return FALSE;
                    }
                }

                return TRUE;
            } else {
                return self::isValidValue($itemType, $value);
            }
        }

        if ($type instanceof InputObjectType) {
            $fields = $type->getFields();
            foreach ($fields as $fieldName => $field) {
                if (!self::isValidValue($field->getType(), isset($value[$fieldName]) ? $value[$fieldName] : NULL)) {
                    return FALSE;
                }
            }

            return TRUE;
        }

        if ($type instanceof ScalarType || $type instanceof EnumType) {
            return NULL !== $type->coerce($value);
        }

        return FALSE;
    }
770299
public function isValueValid($value) {
		return $value instanceof Type\CreativeWorkType || $value instanceof Type\ProductType || $value instanceof DataType\URLType;
	}
1270191
private function checkPartMatchingType($value, $type)
    {
        switch ($type) {
            case "digit":
                return ctype_digit($value);
                break;

            case "hex":
                return ctype_xdigit($value);
                break;

            case "alpha":
                return ctype_alpha($value);
                break;

            case "alphanum":
                return ctype_alnum($value);
                break;

            default:
                return false;
        }
    }
788224
public function isValueValid($value) {
		return $value instanceof Type\ListItem || $value instanceof DataType\TextType || $value instanceof Type\Thing;
	}