TimeResourceNode   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 1
dl 0
loc 40
c 0
b 0
f 0
ccs 12
cts 12
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getCalendar() 0 3 1
A getValueType() 0 3 1
A equals() 0 5 3
1
<?php
2
3
namespace PPP\DataModel;
4
5
/**
6
 * A time resource node.
7
 *
8
 * @licence AGPLv3+
9
 * @author Thomas Pellissier Tanon
10
 */
11
class TimeResourceNode extends ResourceNode {
12
13
	/**
14
	 * @var string
15
	 */
16
	private $calendar;
17
18
	/**
19
	 * @param string $value
20
	 * @param string $calendar
21
	 */
22 5
	public function __construct($value, $calendar = 'gregorian') {
23 5
		$this->calendar = $calendar;
24
25 5
		parent::__construct($value);
26 5
	}
27
28
	/**
29
	 * @return string
30
	 */
31 1
	public function getCalendar() {
32 1
		return $this->calendar;
33
	}
34
35
	/**
36
	 * @return string
37
	 */
38 1
	public function getValueType() {
39 1
		return 'time';
40
	}
41
42
	/**
43
	 * @see AbstractNode::equals
44
	 */
45 3
	public function equals($target) {
46 3
		return $target instanceof self &&
47 3
			$this->getValue() === $target->getValue() &&
48 3
			$this->calendar === $target->calendar;
49
	}
50
}
51