Conditions | 2 |
Paths | 2 |
Total Lines | 19 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 0 |
1 | <?php |
||
13 | public function generate() |
||
14 | { |
||
15 | if (!$this->cache->isAutopromoBannerConfigured()) { |
||
16 | return ''; |
||
17 | } |
||
18 | |||
19 | $url = $this->cache->getAutopromoBannerUrl(); |
||
20 | $script = $this->cache->getAutopromoBannerScript(); |
||
21 | |||
22 | $script = <<<EOS |
||
23 | (function (a,d){var s,t;s=d.createElement('script'); |
||
24 | s.src=a;s.async=1; |
||
25 | t=d.getElementsByTagName('script')[0]; |
||
26 | t.parentNode.insertBefore(s,t); |
||
27 | })("https://$url/$script.js", document); |
||
28 | EOS; |
||
29 | |||
30 | return $script; |
||
31 | } |
||
32 | } |
||
33 |