/** * {@inheritDoc} */ public function normalize($object, ContextInterface $context) { if (!$object instanceof \DateTime) { throw NormalizationFailedException::unexpected($object, 'DateTime'); } return $object->format($this->dateTimeFormat); }
/** * {@inheritDoc} */ public function normalize($object, ContextInterface $context) { if (!$object instanceof Money) { throw NormalizationFailedException::unexpected($object, 'FivePercent\\Component\\Money\\Money'); } return $object->toDouble($this->precision); }