public static function castToString($type, $value)
    {
        if ($value === '') {
            return '';
        }

        switch ($type) {
            case self::PROPERTY_TYPE_BOOLEAN:
                return $value ? 'true' : 'false';

            case self::PROPERTY_TYPE_DATE:
                /**
                 * @var \DateTimeInterface
                 */
                return $value->format('Y-m-d');

            case self::PROPERTY_TYPE_TIMESTAMP:
                /**
                 * @var \DateTimeInterface
                 */
                return $value->format('c');

            case self::PROPERTY_TYPE_OBJECT:
                if ($value instanceof self) {
                    return $value->toStringArray();
                }

                return '';
            default:
                if (is_scalar($value)) {
                    return (string) $value;
                }

                return '';
        }
    }
public static function castToString($type, $value)
    {
        if ($value === '') {
            return '';
        }

        switch ($type) {
            case self::PROPERTY_TYPE_BOOLEAN:
                return $value ? 'true' : 'false';

            case self::PROPERTY_TYPE_DATE:
                /**
                 * @var \DateTimeInterface
                 */
                return $value->format('Y-m-d');

            case self::PROPERTY_TYPE_TIMESTAMP:
                /**
                 * @var \DateTimeInterface
                 */
                return $value->format('c');

            case self::PROPERTY_TYPE_OBJECT:
                if ($value instanceof self) {
                    return $value->toStringArray();
                }

                return '';
            default:
                if (is_scalar($value)) {
                    return (string) $value;
                }

                return '';
        }
    }
public static function castToString ( $ type , $ value ) { if ( $ value === '' ) { return '' ; } switch ( $ type ) { case self :: PROPERTY_TYPE_BOOLEAN : return $ value ? 'true' : 'false' ; case self :: PROPERTY_TYPE_DATE : /**
                 * @var \DateTimeInterface
                 */ return $ value -> format ( 'Y-m-d' ) ; case self :: PROPERTY_TYPE_TIMESTAMP : /**
                 * @var \DateTimeInterface
                 */ return $ value -> format ( 'c' ) ; case self :: PROPERTY_TYPE_OBJECT : if ( $ value instanceof self ) { return $ value -> toStringArray ( ) ; } return '' ; default : if ( is_scalar ( $ value ) ) { return ( string ) $ value ; } return '' ; } }
Convert properties to strings, based on the types parsed.

@param $type
@param $value
@return string
Convert properties to strings based on the types parsed .