1 | <?php |
||
20 | class FetchEventsEmailNotificationListener |
||
21 | { |
||
22 | /** |
||
23 | * @var \Twig_Environment |
||
24 | */ |
||
25 | private $twig; |
||
26 | |||
27 | /** |
||
28 | * @var \Swift_Mailer |
||
29 | */ |
||
30 | private $mailer; |
||
31 | |||
32 | /** |
||
33 | * FetchEventsEmailNotificationListener constructor. |
||
34 | * |
||
35 | * @param \Twig_Environment $twig |
||
36 | * @param \Swift_Mailer $mailer |
||
37 | */ |
||
38 | public function __construct(\Twig_Environment $twig, \Swift_Mailer $mailer) |
||
43 | |||
44 | /** |
||
45 | * Success event handler |
||
46 | * |
||
47 | * @param FetchSuccessEvent $successEvent |
||
48 | */ |
||
49 | public function onFetchSuccess(FetchSuccessEvent $successEvent) |
||
58 | |||
59 | /** |
||
60 | * Error event handler |
||
61 | * |
||
62 | * @param FetchErrorEvent $errorEvent |
||
63 | */ |
||
64 | public function onFetchError(FetchErrorEvent $errorEvent) |
||
73 | |||
74 | /** |
||
75 | * Builds swift message |
||
76 | * |
||
77 | * @param string $template |
||
78 | * @param array $context |
||
79 | * |
||
80 | * @return \Swift_Message |
||
81 | */ |
||
82 | private function buildSwiftMessage($template, array $context = []) |
||
93 | |||
94 | /** |
||
95 | * Render twig template single block |
||
96 | * |
||
97 | * @param string $template |
||
98 | * @param string $block |
||
99 | * @param array $context |
||
100 | * |
||
101 | * @return string |
||
102 | */ |
||
103 | private function renderBlock($template, $block, array $context = []) |
||
111 | } |
||
112 |