Internal function utilized by setValueAttribute to find the value type and set the attribute accordingly.

@param $value
@return bool|float|int|string
549137
private function setValue($value)
    {
        switch (gettype($value)) {
            case 'int':
            case 'integer':
                $this->attributes['type'] = 'int';

                return (int) $value;
            case 'real':
            case 'float':
            case 'double':
                $this->attributes['type'] = 'float';

                return (float) $value;
            case 'bool':
            case 'boolean':
                $this->attributes['type'] = 'bool';

                return (bool) $value;
            case 'object':
                if ($value instanceof Collection) {
                    $this->attributes['type'] = 'collection';

                    return json_encode($value);
                }
                $this->attributes['type'] = 'object';

                return json_encode($value);
            case 'array':
                $this->attributes['type'] = 'array';

                return json_encode($value);
            default:
                $this->attributes['type'] = 'string';

                return $value;
        }
    }
1217163
public function createAttributeValue($value)
    {
        $v = new BooleanValue();
        $value = ($value == false || $value == '0') ? false : true;
        $v->setValue($value);

        return $v;
    }
968680
public function getTypeFromValue($value = null)
    {
        $value = ($value === null ? $this->value : $value);
        return array_search($value, self::$typeList);
    }
538549
protected function detectType($value)
    {
        if (is_bool($value)) {
            return $value ? self::BINN_TRUE : self::BINN_FALSE;
        }

        if (is_string($value)) {
            return self::BINN_STRING;
        }

        if (is_integer($value)) {
            return $this->detectInt($value);
        }

        if (is_float($value)) {
            if (strlen($value) > 4) {
                return self::BINN_FLOAT64;
            } else {
                return self::BINN_FLOAT32;
            }
        }

        if (is_array($value)) {
            foreach ($this->containersClasses as $contanerType => $containersClass) {
                if ($containersClass::validArray($value)) {
                    return $contanerType;
                }
            }
        }

        return self::BINN_NULL;
    }
710061
public function createAttributeValue($value)
    {
        $av = new NumberValue();
        $value = ($value == false || $value == '0') ? 0 : $value;
        $av->setValue($value);

        return $av;
    }
267191
private function getValueType($value)
    {
        if (is_string($value))
            return 'string';
        if (is_bool($value))
            return 'bool';
        if (is_float($value))
            return 'float';
        if (is_numeric($value))
            return 'int';
        if (is_array($value))
            return 'array';
        return 'mixed';
    }
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;
		}
	}
1322016
public function value($value = null) {

        if(null !== $value && false === is_string($value) && false === is_numeric($value)) {
            return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string or number, "%s" given', __METHOD__, gettype($value)), E_USER_ERROR);
        }

        $this -> value = (string) $value;
        $this -> attributes['value'] = (string) $value;

        return $this;
    }
787295
protected function convert ($type, $value)
		{
			switch ($type)
			{
				case 'string':
					return (string) $value;

				case 'number':
					return is_float($value)
						? (float) $value
						: (int) $value;

				case 'boolean':
					return $value === true || $value === 'true' || $value === '1' || $value === 'on';

				default:
					if (is_float($value))
					{
						return $this->convert('number', $value);
					}
					if (is_numeric($value))
					{
						return strpos($value, '.') !== FALSE
							? (float) $value
							: (int) $value;
					}
					if ($value === 'true' || $value === 'false')
					{
						return $value === 'true';
					}
					if ($value === '')
					{
						return null;
					}
			}
			return $value;
		}
324092
protected function toType($value, $type)
    {
        if (in_array($type, ['integer', 'float']) && !in_array($value, ['', null], true)) {
            settype($value, $type);
        } else if ($type == 'boolean') {
            $value = (bool)$value;
        } else if ($type == 'many') {
            $value = $value ?: [];
        }
        return $value === '' ? null : $value;
    }
945563
public function typeCast($value)
    {
        if ($value === null) {
            return $value;
        }
        
        switch ($this->type) {
            case 'string':
            case 'text':
            case 'binary':
            default:
                return $value;
            case 'integer':
                return $this->valueToInteger($value);
            case 'float':
                return (float)$value;
            case 'datetime':
            case 'timestamp':
                return $this->stringToTime($value);
            case 'time':
                return $this->stringToDummyTime($value);
            case 'date':
                return $this->valueToDate($value);
            case 'boolean':
                return $this->valueToBoolean($value);
            default:
                return $value;
        }
    }
343337
protected function getDataTypeByValue($value)
    {
        if(null === $value)
        {
            return \PDO::PARAM_NULL;
        }
        if(is_bool($value))
        {
            return \PDO::PARAM_BOOL;
        }
        if(is_int($value))
        {
            return \PDO::PARAM_INT;
        }
        return \PDO::PARAM_STR;
    }
613719
public function getTypeFromValue($value = null)
    {
        $value = ($value == null ? $this->value : $value);
        return array_search($value, self::$codeList);
    }
930575
public static function getTypeFromValue($value)
    {
        switch (gettype($value)) {
            case 'boolean':
                if ($value) {
                    return Type::getTrue();
                }

                return Type::getFalse();

            case 'integer':
                return Type::getInt(false, $value);

            case 'double':
                return Type::getFloat($value);

            case 'string':
                return Type::getString($value);

            case 'array':
                return Type::getArray();

            case 'NULL':
                return Type::getNull();

            default:
                return Type::getMixed();
        }
    }
646978
protected function unserialize($value)
    {
        if (filter_var($value, FILTER_VALIDATE_INT) !== false) {
            return (int) $value;
        }

        if (is_numeric($value)) {
            return (float) $value;
        }

        return unserialize($value);
    }
577457
protected function detectType($value): int
    {
        switch (gettype($value)) {
            case 'boolean':
                return \PDO::PARAM_BOOL;
            case 'integer':
                return \PDO::PARAM_INT;
            case 'NULL':
                return \PDO::PARAM_NULL;
            default:
                return \PDO::PARAM_STR;
        }
    }
894822
private function convertType($value)
    {
        $type = gettype($value);

        if ($this->type === $type || !is_scalar($value)) {
            return $value;
        }

        switch ($this->type) {
            case self::TYPE_BOOL:
                return $this->convertBool($value);
            case self::TYPE_INT:
                return $this->convertInt($value);
            case self::TYPE_FLOAT:
                return $this->convertFloat($value);
            default:
                return $this->convertString($value);
        }
    }