Determines the type of the specified value

@param mixed $value Any value

@return string The type of the {@link $value} specified
768958
public static function getQualifiedType($value)
    {
        if (is_null($value))
            return 'NULL';

        if (is_string($value))
            return 'string';
        else if (is_array($value)) {
            if (!empty ($value)) {
                foreach ($value as $val) {
                    $array_type = self::getQualifiedType($val);
                    if ($array_type != null)
                        break;
                }
                return $array_type . '[]';
            } else {
                return 'array';
            }
        } else if (is_int($value))
            return 'int';
        else if (is_bool($value))
            return 'boolean';
        else if (is_float($value))
            return 'float';
        else if (is_object($value))
            return get_class($value);
    }
428445
static function guessType($value)
    {
        $map = array(
            "float"=>"number",
            "double"=>"number",
            "int"=>"number",
            "integer"=>"number",
            "bool"=>"number",
            "numeric"=>"number",
            "string"=>"string",
        );

        $type = strtolower(gettype($value));
        foreach ($map as $key=>$value) {
            if (strpos($type, $key)!==false) {
                return $value;
            }
        }
        return "unknown";
    }
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);
        }
    }
428391
private function getTypedValue(string $value)
    {
        if (\in_array($value, self::$boolValues, true)) {
            return \in_array($value, self::$truthlyValues, true);
        }

        if (\is_numeric($value)) {
            return $this->getNumericValue($value);
        }

        return $value;
    }
1097467
public function getTypeForValue($value) : string
    {
        foreach ($this->handlers as $type => $handler) {
            if ($handler->canHandleValue($value)) {
                return $type;
            }
        }

        throw DataTypeException::handlerNotFoundForValue($value);
    }
572865
public function geetParamTypeByValue($value)
	{
		switch(gettype($value))
		{
			case 'boolean':
				return PDO::PARAM_BOOL;
				break;
			case 'integer':
				return PDO::PARAM_INT;
				break;
			case 'NULL':
				return PDO::PARAM_NULL;
				break;
			default:
				return PDO::PARAM_STR;
				break;
		}
	}
517264
static public function inferBaseType($value)
    {
        if ($value === null) {
            return false;
        } elseif ($value instanceof RecordContainer) {
            return false;
        } elseif ($value instanceof QtiDatatype) {
            return $value->getBaseType();
        } else {
            return false;
        }
    }
1189592
public static function getType($value)
    {
        if (is_int($value)) {
            return MDataType::INT;
        }

        if (is_long($value)) {
            return MDataType::LONG;
        }

        if (is_bool($value)) {
            return MDataType::BOOLEAN;
        }

        if (is_float($value)) {
            return MDataType::FLOAT;
        }

        if (is_double($value)) {
            return MDataType::DOUBLE;
        }

        if (is_string($value)) {
            return MDataType::STRING;
        }

        if ($value == null) {
            return MDataType::NULL;
        }

        if (is_array($value)) {
            return MDataType::__ARRAY;
        }

        if (is_object($value)) {
            return MDataType::OBJECT;
        }

        if (is_resource($value)) {
            return MDataType::RESOURCE;
        }

        return MDataType::UNKNOWN;
    }
786262
public static function fromValue($value) : Type
    {
        switch (gettype($value)) {
            case 'string':
                return Text::long();

            case 'integer':
                return Integer::big();

            case 'double':
                return new Decimal(30, 15);

            case 'boolean':
                return new Boolean();

            case $value instanceof \DateTimeInterface:
                return new DateTime();

            default:
                throw InvalidArgumentException::format(
                        'Invalid call to %s: unknown value type \'%s\' given',
                        __METHOD__, gettype($value)
                );
        }
    }
708470
public function type($value)
    {
        if ($value instanceof SuperTableBlockType) {
            $this->typeId = $value->id;
        } else if ($value !== null) {
            $this->typeId = (new Query())
                ->select(['id'])
                ->from(['{{%supertableblocktypes}}'])
                ->where(Db::parseParam('id', $value))
                ->column();
        } else {
            $this->typeId = null;
        }

        return $this;
    }
440002
protected function convertType($value)
    {
        switch(true) {

            case is_bool($value):
                return new BoolType;

            case is_int($value):
                return new NumberType(['nativeType'=>'int']);

            case is_float($value):
                return new NumberType(['nativeType'=>'float']);

            case is_null($value):
                return new StringType(['canBeNull'=>true]);

            case $value instanceof DateTime:
                return new TemporalType;

            case $this->isSequence($value):
                return $this->createSequence($value);

            case is_object($value):
                return $this->createObject($value);

            case $this->hasKeysAndValues($value):
                return $this->createArrayType($value);

            default:
                return new StringType;
        }

    }
155300
public static function getValidTypeFromSample($value) {
        $value = trim((string) $value);

        if (empty($value)) {
            return false;
        }

        foreach (self::$validators as $type => $validator) {
            if ($validator === null) {
                continue;
            }

            if (method_exists(__CLASS__, $validator) && self::$validator($value)) {
                return $type;
            }
        }

        return self::__DEFAULT;
    }
879827
private function autoDetectType($value)
    {
        if (is_array($value)) {
            foreach ($value as $val) {
                if (!is_numeric($val)) {
                    return Type::STRING_SET;
                }
            }
            return Type::NUMBER_SET;
        } elseif (is_numeric($value)) {
            return Type::NUMBER;
        } else {
            return Type::STRING;
        }
    }
672780
private function parseType(string $value)
    {
        if ((substr($value, 0, 1) === '"' && substr($value, -1) === '"') || (substr($value, 0, 1) === "'" && substr($value, -1) === "'")) {
            return substr($value, 1, strlen($value) - 2);
        }

        return Parse::toType($value);
    }
817381
public static function getTypeForValue($value): string
    {
        if (is_object($value)) {
            if ($value instanceof Proxy) {
                $type = get_parent_class($value);
            } else {
                $type = get_class($value);
            }
        } else {
            $type = gettype($value);
        }
        return $type;
    }
683858
public function isValueValid($value) {
		return $value instanceof DataType\BooleanType || $value instanceof DataType\TextType || $value instanceof DataType\URLType;
	}
541023
protected function resolveTypeDescription($value): string
    {
        $type = gettype($value);

        if ($type === 'object') {
            return 'an instance of ' . get_class($value);
        }

        if ($type === 'integer') {
            return 'an integer';
        }

        return 'a ' . $type;
    }