public function serializeDateTimeImmutable(VisitorInterface $visitor, \DateTimeInterface $date, array $type, Context $context) { if ($visitor instanceof XmlSerializationVisitor && false === $this->xmlCData) { return $visitor->visitSimpleString($date->format($this->getFormat($type)), $type, $context); } return $visitor->visitString($date->format($this->getFormat($type)), $type, $context); }
public function serializeDateInterval(VisitorInterface $visitor, \DateInterval $date, array $type, Context $context) { $iso8601DateIntervalString = $this->format($date); if ($visitor instanceof XmlSerializationVisitor && false === $this->xmlCData) { return $visitor->visitSimpleString($iso8601DateIntervalString, $type, $context); } return $visitor->visitString($iso8601DateIntervalString, $type, $context); }
/** * @param VisitorInterface $visitor * @param FloatType $data * @param array $type * @param Context $context * * @return mixed|void */ public function serializeFloatType(VisitorInterface $visitor, FloatType $data, array $type, Context $context) { $numberFormatter = new \NumberFormatter($this->getLocale($type), $this->getFormat($type)); if ($visitor instanceof XmlSerializationVisitor && false === $this->xmlCData) { return $visitor->visitSimpleString($numberFormatter->format($data->getValue()), $type, $context); } return $visitor->visitString($numberFormatter->format($data->getValue()), $type, $context); }