GuidGenerator   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A newGuid() 0 3 1
1
<?php
2
3
namespace Wikibase\DataModel\Services\Statement;
4
5
use Wikibase\DataModel\Entity\EntityId;
6
use Wikibase\DataModel\Statement\StatementGuid;
7
8
/**
9
 * @since 1.0
10
 *
11
 * @license GPL-2.0-or-later
12
 * @author Jeroen De Dauw < [email protected] >
13
 * @author Daniel Kinzler
14
 * @author Addshore
15
 */
16
class GuidGenerator {
17
18
	/**
19
	 * @var V4GuidGenerator
20
	 */
21
	private $baseGenerator;
22
23 3
	public function __construct() {
24 3
		$this->baseGenerator = new V4GuidGenerator();
25 3
	}
26
27
	/**
28
	 * Generates and returns a GUID for a statement in the given Entity.
29
	 *
30
	 * @since 1.0
31
	 *
32
	 * @param EntityId $entityId
33
	 *
34
	 * @return string
35
	 */
36 3
	public function newGuid( EntityId $entityId ) {
37 3
		return $entityId->getSerialization() . StatementGuid::SEPARATOR . $this->baseGenerator->newGuid();
38
	}
39
40
}
41