Completed
Branch master (f4bc72)
by
unknown
02:50
created

Experiments   A

↳ Parent: Project

Coupling/Cohesion

Components 1
Dependencies 3

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 3
dl 0
loc 36
c 0
b 0
f 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A renderStart() 0 12 2
1
<?php
2
namespace Redaxscript\Modules\Experiments;
3
4
use Redaxscript\Head;
5
use Redaxscript\Registry;
6
7
/**
8
 * integrate google experiments
9
 *
10
 * @since 3.0.0
11
 *
12
 * @package Redaxscript
13
 * @category Modules
14
 * @author Henry Ruhs
15
 */
16
17
class Experiments extends Config
18
{
19
	/**
20
	 * array of the module
21
	 *
22
	 * @var array
23
	 */
24
25
	protected static $_moduleArray =
26
	[
27
		'name' => 'Experiments',
28
		'alias' => 'Experiments',
29
		'author' => 'Redaxmedia',
30
		'description' => 'Integrate Google Experiments',
31
		'version' => '3.0.0'
32
	];
33
34
	/**
35
	 * renderStart
36
	 *
37
	 * @since 3.0.0
38
	 */
39
40
	public static function renderStart()
41
	{
42
		if (Registry::get('loggedIn') !== Registry::get('token'))
43
		{
44
			$script = Head\Script::getInstance();
45
			$script
46
				->init('foot')
47
				->appendFile('//google-analytics.com/cx/api.js?experiment=' . self::$_configArray['id'])
48
				->appendFile('modules/Experiments/assets/scripts/init.js')
49
				->appendFile('modules/Experiments/assets/scripts/experiments.js');
50
		}
51
	}
52
}
53