Conditions | 4 |
Paths | 5 |
Total Lines | 22 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 13 |
CRAP Score | 4 |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
40 | 3 | public function getScript() |
|
41 | { |
||
42 | 3 | if (empty($this->participations)) { |
|
43 | 1 | return ''; |
|
44 | } |
||
45 | |||
46 | 2 | $script = []; |
|
47 | |||
48 | 2 | if (true === $this->getApiCLientInclusion()) { |
|
49 | 1 | $script[] = '<script src="//www.google-analytics.com/cx/api.js"></script>'; |
|
50 | 1 | } |
|
51 | |||
52 | 2 | $script[] = '<script>'; |
|
53 | |||
54 | 2 | foreach ($this->participations as $testIdentifier => $variationIndex) { |
|
55 | 2 | $script[] = "cxApi.setChosenVariation(" . (int) $variationIndex . ", '" . (string) $testIdentifier . "')"; |
|
56 | 2 | } |
|
57 | |||
58 | 2 | $script[] = '</script>'; |
|
59 | |||
60 | 2 | return implode(PHP_EOL, $script); |
|
61 | } |
||
62 | |||
72 |