FakeEntityDocument   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 66
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 8
lcom 1
cbo 0
dl 0
loc 66
rs 10
c 0
b 0
f 0

8 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getId() 0 3 1
A getType() 0 3 1
A setId() 0 3 1
A isEmpty() 0 3 1
A equals() 0 3 1
A copy() 0 3 1
A clear() 0 2 1
1
<?php
2
3
namespace Wikibase\DataModel\Services\Fixtures;
4
5
use Wikibase\DataModel\Entity\EntityDocument;
6
use Wikibase\DataModel\Entity\EntityId;
7
8
/**
9
 * @license GPL-2.0-or-later
10
 * @author Jeroen De Dauw < [email protected] >
11
 */
12
class FakeEntityDocument implements EntityDocument {
13
14
	/**
15
	 * @var EntityId|null
16
	 */
17
	private $id;
18
19
	public function __construct( EntityId $id = null ) {
20
		$this->id = $id;
21
	}
22
23
	/**
24
	 * @return EntityId|null
25
	 */
26
	public function getId() {
27
		return $this->id;
28
	}
29
30
	/**
31
	 * @return string Returns the entity type of the provided EntityId.
32
	 */
33
	public function getType() {
34
		return $this->id->getEntityType();
35
	}
36
37
	/**
38
	 * @param EntityId $id
39
	 */
40
	public function setId( $id ) {
41
		$this->id = $id;
42
	}
43
44
	/**
45
	 * @return bool
46
	 */
47
	public function isEmpty() {
48
		return true;
49
	}
50
51
	/**
52
	 * @see EntityDocument::equals
53
	 *
54
	 * @param mixed $target
55
	 *
56
	 * @return bool Always true.
57
	 */
58
	public function equals( $target ) {
59
		return true;
60
	}
61
62
	/**
63
	 * @see EntityDocument::copy
64
	 *
65
	 * @return self
66
	 */
67
	public function copy() {
68
		return new self( $this->id );
69
	}
70
71
	/**
72
	 * @see EntityDocument::clear
73
	 */
74
	public function clear() {
75
	}
76
77
}
78