protected function forceType($value, $type) {
        $type = strtolower($type);

        if ($type === 'null') {
            return null;
        } elseif ($type === 'boolean') {
            return filter_var($value, FILTER_VALIDATE_BOOLEAN);
        } elseif (in_array($type, ['int', 'integer', 'tinyint', 'smallint',
            'mediumint', 'bigint', 'unsigned big int', 'int2', 'int8', 'boolean'])) {
            return filter_var($value, FILTER_VALIDATE_INT);
        } elseif (in_array($type, ['real', 'double', 'double precision', 'float',
            'numeric', 'number', 'decimal(10,5)'])) {
            return filter_var($value, FILTER_VALIDATE_FLOAT);
        } else {
            return (string)$value;
        }
    }
protected function forceType($value, $type) {
        $type = strtolower($type);

        if ($type === 'null') {
            return null;
        } elseif ($type === 'boolean') {
            return filter_var($value, FILTER_VALIDATE_BOOLEAN);
        } elseif (in_array($type, ['int', 'integer', 'tinyint', 'smallint',
            'mediumint', 'bigint', 'unsigned big int', 'int2', 'int8', 'boolean'])) {
            return filter_var($value, FILTER_VALIDATE_INT);
        } elseif (in_array($type, ['real', 'double', 'double precision', 'float',
            'numeric', 'number', 'decimal(10,5)'])) {
            return filter_var($value, FILTER_VALIDATE_FLOAT);
        } else {
            return (string)$value;
        }
    }
protected function forceType ( $ value , $ type ) { $ type = strtolower ( $ type ) ; if ( $ type === 'null' ) { return null ; } elseif ( $ type === 'boolean' ) { return filter_var ( $ value , FILTER_VALIDATE_BOOLEAN ) ; } elseif ( in_array ( $ type , [ 'int' , 'integer' , 'tinyint' , 'smallint' , 'mediumint' , 'bigint' , 'unsigned big int' , 'int2' , 'int8' , 'boolean' ] ) ) { return filter_var ( $ value , FILTER_VALIDATE_INT ) ; } elseif ( in_array ( $ type , [ 'real' , 'double' , 'double precision' , 'float' , 'numeric' , 'number' , 'decimal(10,5)' ] ) ) { return filter_var ( $ value , FILTER_VALIDATE_FLOAT ) ; } else { return ( string ) $ value ; } }
Force a value into the appropriate php type based on its SQL type.

@param mixed $value The value to force.
@param string $type The sqlite type name.
@return mixed Returns $value cast to the appropriate type.
Force a value into the appropriate php type based on its SQL type .