1 | <?php |
||
20 | class FetchEventsEmailNotificationListener |
||
21 | { |
||
22 | /** |
||
23 | * @var \Twig_Environment |
||
24 | */ |
||
25 | protected $twig; |
||
26 | |||
27 | /** |
||
28 | * @var \Swift_Mailer |
||
29 | */ |
||
30 | protected $mailer; |
||
31 | |||
32 | /** |
||
33 | * @var string[] |
||
34 | */ |
||
35 | protected $recipients; |
||
36 | |||
37 | /** |
||
38 | * FetchEventsEmailNotificationListener constructor. |
||
39 | * |
||
40 | * @param \Twig_Environment $twig |
||
41 | * @param \Swift_Mailer $mailer |
||
42 | */ |
||
43 | public function __construct(\Twig_Environment $twig, \Swift_Mailer $mailer, array $recipients) |
||
49 | |||
50 | /** |
||
51 | * Success event handler |
||
52 | * |
||
53 | * @param FetchSuccessEvent $successEvent |
||
54 | */ |
||
55 | public function onFetchSuccess(FetchSuccessEvent $successEvent) |
||
64 | |||
65 | /** |
||
66 | * Error event handler |
||
67 | * |
||
68 | * @param FetchErrorEvent $errorEvent |
||
69 | */ |
||
70 | public function onFetchError(FetchErrorEvent $errorEvent) |
||
79 | |||
80 | /** |
||
81 | * Builds swift message |
||
82 | * |
||
83 | * @param string $template |
||
84 | * @param array $context |
||
85 | * |
||
86 | * @return \Swift_Message |
||
87 | */ |
||
88 | private function buildSwiftMessage($template, array $context = []) |
||
99 | |||
100 | /** |
||
101 | * Render twig template single block |
||
102 | * |
||
103 | * @param string $template |
||
104 | * @param string $block |
||
105 | * @param array $context |
||
106 | * |
||
107 | * @return string |
||
108 | */ |
||
109 | private function renderBlock($template, $block, array $context = []) |
||
117 | } |
||
118 |