1 | <?php |
||
18 | class AzineEmailOpenTrackingCodeBuilder implements EmailOpenTrackingCodeBuilderInterface { |
||
19 | |||
20 | /** |
||
21 | * @var string |
||
22 | */ |
||
23 | protected $tracking_params_campaign_source; |
||
24 | |||
25 | /** |
||
26 | * @var string |
||
27 | */ |
||
28 | protected $tracking_params_campaign_medium; |
||
29 | |||
30 | /** |
||
31 | * @var string |
||
32 | */ |
||
33 | protected $tracking_params_campaign_content; |
||
34 | |||
35 | /** |
||
36 | * @var string |
||
37 | */ |
||
38 | protected $tracking_params_campaign_name; |
||
39 | |||
40 | /** |
||
41 | * @var string |
||
42 | */ |
||
43 | protected $tracking_params_campaign_term; |
||
44 | |||
45 | /** |
||
46 | * @var $string|null |
||
47 | */ |
||
48 | private $trackingUrlTemplate; |
||
49 | |||
50 | /** |
||
51 | * @var string the html-code template |
||
52 | */ |
||
53 | protected $imageHtmlCode = "<img src='%s' style='border:0' alt='' />"; |
||
54 | |||
55 | /** |
||
56 | * @param $trackingUrlTemplate the url configured in your config.yml or null if you didn't specify a tracking url. |
||
57 | * @param $parameters array with the parameter names for the campaign tracking |
||
58 | */ |
||
59 | 8 | public function __construct($trackingUrlTemplate, $parameters){ |
|
67 | |||
68 | /** |
||
69 | * @param $templateBaseId the template used for rendering the email (without the .html.twig or .txt.twig extension) |
||
70 | * @param array $campaignParams the campaign-parameters used for this email |
||
71 | * @param the $messageId the id of the message |
||
72 | * @param email $to to-recipient-email(s) or null |
||
73 | * @param email $cc cc-recipient-email(s) or null |
||
74 | * @param email $bcc bcc-recipient-email(s) or null |
||
75 | * |
||
76 | * @return null|string Email open tracking code for google analytics or piwik or null |
||
77 | */ |
||
78 | public function getTrackingImgCode($templateBaseId, array $campaignParams, array $emailTemplateParams, $messageId, $to, $cc, $bcc){ |
||
96 | |||
97 | /** |
||
98 | * concatenate all recipients into an array and implode with ';' to a string |
||
99 | * @param $to |
||
100 | * @param $cc |
||
101 | * @param $bcc |
||
102 | * @return string |
||
103 | */ |
||
104 | protected function merge($to, $cc, $bcc){ |
||
118 | |||
119 | /** |
||
120 | * Build tracking image code with an URL according to these sources: |
||
121 | * http://dyn.com/blog/tracking-email-opens-via-google-analytics/ |
||
122 | * https://developers.google.com/analytics/devguides/collection/protocol/v1/email#protocol |
||
123 | * |
||
124 | * @param $baseUrl string something like: https://www.google-analytics.com/collect?v=1&cm=email&t=event&ec=email&ea=open&tid=TRACKING_ID replace the TRACKING_ID with your google analytics tracking ID. |
||
125 | * @param $templateBaseId string |
||
126 | * @param array $campaignParams |
||
127 | * @param array $emailTemplateParams |
||
128 | * @param $messageId string |
||
129 | * @param $recipients string |
||
130 | */ |
||
131 | protected function getGoogleAnalyticsUrl($baseUrl, $templateBaseId, array $campaignParams, array $emailTemplateParams, $messageId, $recipients){ |
||
143 | |||
144 | /** |
||
145 | * Build tracking image code with an URL according to these sources: |
||
146 | * |
||
147 | * |
||
148 | * @param $baseUrl string something like: https://your.host.com/piwik-directory/piwik.php?&rec=1&bots=1&e_c=email&e_a=open&e_v=1&idsite=SITE_ID replace the path to your piwik.php and the SITE_ID according to your needs. |
||
149 | * @param $templateBaseId string |
||
150 | * @param array $campaignParams |
||
151 | * @param array $emailTemplateParams |
||
152 | * @param $messageId string |
||
153 | * @param $recipients string |
||
154 | */ |
||
155 | protected function getPiwikUrl($baseUrl, $templateBaseId, array $campaignParams, array $emailTemplateParams, $messageId, $recipients){ |
||
165 | |||
166 | /** |
||
167 | * @param $campaignParams |
||
168 | * @param $templateId |
||
169 | * @return string if no source-value is defined in the $campaignParams, $templateId will be used. |
||
170 | */ |
||
171 | protected function getCampaignSource($campaignParams, $templateId){ |
||
177 | |||
178 | /** |
||
179 | * @param $campaignParams |
||
180 | * @param $templateId |
||
181 | * @return string if no name-value is defined in the $campaignParams, $templateId will be used. |
||
182 | */ |
||
183 | protected function getCampaignName($campaignParams){ |
||
189 | } |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.