getContainer()->get('templating'); } /** * @param ThemeTypeEnum $themeType A ThemeTypeEnum instance. * @param array $diffs Notification theme diffs. * @param FeedData[] $data Array of feed data. * * @return string */ protected function render(ThemeTypeEnum $themeType, array $diffs = [], array $data = []) { $notification = Notification::create() ->setTheme( NotificationTheme::create() ->setEnhanced(NotificationThemeOptions::createDefault()) ->setPlain(NotificationThemeOptions::createDefault()) ) ->setThemeType($themeType); switch ($themeType->getValue()) { case ThemeTypeEnum::ENHANCED: $notification->setEnhancedThemeOptionsDiff($diffs); break; case ThemeTypeEnum::PLAIN: $notification->setPlainThemeOptionsDiff($diffs); break; default: throw new \DomainException('Unhandled theme type: '. $themeType->getValue()); } $sendableNotification = new SendableNotification( new SendableNotificationConfig( 0, 0, 0, 0, '
empty
', 0 ), $notification, $data ); return $sendableNotification->render(self::$templating); } }