in src/Serializer.php [220:254]
private static function castToString($value, ?string $format): string
{
if ($value instanceof \DateTimeInterface) {
$stamp = $value->getTimestamp();
if ($format == null) {
$format = 'iso8601';
}
switch ($format) {
case 'httptime':
$tval = gmdate('D, d M Y H:i:s \G\M\T', $stamp);
break;
case 'unixtime':
$tval = (string)$stamp;
break;
default:
$tval = gmdate('Y-m-d\TH:i:s\Z', $stamp);
}
return $tval;
}
$type = \gettype($value);
// bool
if (\in_array($type, ['bool', 'boolean'])) {
return $value === true ? 'true' : 'false';
}
// other primitive type
if (\in_array($type, ['int', 'integer', 'float', 'double', 'string'])) {
return (string)$value;
}
throw new SerializationExecption("Unsupport type " . \gettype($value));
}