src/models/Property.php
public static function castValueToDataType($value, $type)
    {
        switch ($type) {
            case Property::DATA_TYPE_FLOAT:
                return empty($value) ? null : (float) $value;
                break;

            case Property::DATA_TYPE_BOOLEAN:
                return empty($value) ? null : (bool) $value;
                break;

            case Property::DATA_TYPE_INTEGER:
                return empty($value) ? null : (int) $value;
                break;

            default:
                return $value;
                break;
        }
    }
public static function castValueToDataType($value, $type)
    {
        switch ($type) {
            case Property::DATA_TYPE_FLOAT:
                return empty($value) ? null : (float) $value;
                break;

            case Property::DATA_TYPE_BOOLEAN:
                return empty($value) ? null : (bool) $value;
                break;

            case Property::DATA_TYPE_INTEGER:
                return empty($value) ? null : (int) $value;
                break;

            default:
                return $value;
                break;
        }
    }
public static function castValueToDataType ( $ value , $ type ) { switch ( $ type ) { case Property :: DATA_TYPE_FLOAT : return empty ( $ value ) ? null : ( float ) $ value ; break ; case Property :: DATA_TYPE_BOOLEAN : return empty ( $ value ) ? null : ( bool ) $ value ; break ; case Property :: DATA_TYPE_INTEGER : return empty ( $ value ) ? null : ( int ) $ value ; break ; default : return $ value ; break ; } }
Casts value to data type

@param mixed $value
@param integer $type

@return mixed
Casts value to data type