Prado\Data\SqlMap\DataMapper\TSqlMapTypeHandlerRegistry::convertToType PHP Méthode

convertToType() public méthode

Converts the value to given type using PHP's settype() function.
public convertToType ( $type, $value ) : mixed
Résultat mixed type casted value.
    public function convertToType($type, $value)
    {
        switch (strtolower($type)) {
            case 'integer':
            case 'int':
                $type = 'integer';
                break;
            case 'float':
            case 'double':
            case 'decimal':
                $type = 'float';
                break;
            case 'boolean':
            case 'bool':
                $type = 'boolean';
                break;
            case 'string':
                $type = 'string';
                break;
            default:
                return $value;
        }
        settype($value, $type);
        return $value;
    }