1 | <?php |
||
24 | class Tracker |
||
25 | { |
||
26 | |||
27 | /** |
||
28 | * @var string |
||
29 | */ |
||
30 | private $baseUrl; |
||
31 | |||
32 | /** |
||
33 | * @var FactoryInterface |
||
34 | */ |
||
35 | private $modelFactory; |
||
36 | |||
37 | /** |
||
38 | * @param string $baseUrl Base URL. |
||
39 | * @param FactoryInterface $modelFactory Model factory to create link and log objects. |
||
40 | */ |
||
41 | public function __construct(string $baseUrl, FactoryInterface $modelFactory) |
||
46 | |||
47 | /** |
||
48 | * @param Email $email Email object to update. |
||
49 | * @param string $emailLogId Email log ID, to generate image link for. |
||
50 | * @return void |
||
51 | */ |
||
52 | public function addOpenTrackingImage(Email &$email, string $emailLogId): void |
||
65 | |||
66 | /** |
||
67 | * @param Email $email Email object to update. |
||
68 | * @param string $emailLogId Email log ID, to generate links for. |
||
69 | * @return void |
||
70 | */ |
||
71 | public function replaceLinksWithTracker(Email &$email, string $emailLogId): void |
||
84 | |||
85 | /** |
||
86 | * @param string $emailLogId Email log ID, to track. |
||
87 | * @param string|null $ip Client IP address. |
||
88 | * @return void |
||
89 | */ |
||
90 | public function trackOpen(string $emailLogId, ?string $ip): void |
||
98 | |||
99 | /** |
||
100 | * @param string $linkId Link ID, to track. |
||
101 | * @param string|null $ip Client IP address. |
||
102 | * @return void |
||
103 | */ |
||
104 | public function trackLink(string $linkId, ?string $ip): void |
||
112 | |||
113 | /** |
||
114 | * @param string $emailLogId Email log ID, to create link for. |
||
115 | * @param string $url URL to redirect to. |
||
116 | * @return string |
||
117 | */ |
||
118 | private function createLink(string $emailLogId, string $url): string |
||
126 | } |
||
127 |