Base   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 54
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A __toString() 0 4 1
A render() 0 9 1
1
<?php
2
namespace Redaxscript\Head;
3
4
use Redaxscript\Html;
5
use Redaxscript\Registry;
6
7
/**
8
 * children class to create the base tag
9
 *
10
 * @since 3.0.0
11
 *
12
 * @package Redaxscript
13
 * @category Head
14
 * @author Henry Ruhs
15
 * @author Balázs Szilágyi
16
 */
17
18
class Base implements HeadInterface
19
{
20
	/**
21
	 * instance of the registry class
22
	 *
23
	 * @var Registry
24
	 */
25
26
	protected $_registry;
27
28
	/**
29
	 * constructor of the class
30
	 *
31
	 * @since 3.0.0
32
	 *
33
	 * @param Registry $registry instance of the registry class
34
	 */
35
36 1
	public function __construct(Registry $registry)
37
	{
38 1
		$this->_registry = $registry;
39 1
	}
40
41
	/**
42
	 * stringify the base
43
	 *
44
	 * @since 3.0.0
45
	 *
46
	 * @return string
47
	 */
48
49 1
	public function __toString() : string
50
	{
51 1
		return $this->render();
52
	}
53
54
	/**
55
	 * render the base
56
	 *
57
	 * @since 3.0.0
58
	 *
59
	 * @return string
60
	 */
61
62 1
	public function render() : string
63
	{
64 1
		$baseElement = new Html\Element();
65 1
		$baseElement->init('base',
66
		[
67 1
			'href' => $this->_registry->get('root') . '/'
68
		]);
69 1
		return $baseElement->render();
70
	}
71
}