/** * @param CustomerEvent $event * * @return array * * @throws UnsupportedClassException */ public function serialize($event) : array { if (!$event instanceof CustomerEvent) { throw new UnsupportedClassException(); } return ['id' => $event->getId(), 'type' => $event->getType(), 'customerId' => $event->getCustomerId(), 'anonymousCustomerId' => $event->getAnonymousCustomerId(), 'time' => $event->getTime()->format(self::MYSQL_DATETIME_FORMAT), 'data' => json_encode($event->getData())]; }