public function objectProperty($value)
{
switch (true) {
case $value instanceof Int64:
return ['integerValue' => $value->get()];
break;
case $value instanceof Blob:
return ['blobValue' => $this->encode ? base64_encode((string) $value) : (string) $value];
break;
case $value instanceof \DateTimeInterface:
return ['timestampValue' => $value->format(self::DATE_FORMAT)];
break;
case $value instanceof Entity:
return ['entityValue' => $this->objectToRequest($value)];
break;
case $value instanceof GeoPoint:
return ['geoPointValue' => $value->point()];
break;
case $value instanceof Key:
return ['keyValue' => $value->keyObject()];
break;
default:
throw new InvalidArgumentException(sprintf('Value of type `%s` could not be serialized', get_class($value)));
break;
}
}