Completed
Push — master ( d93f11...86f8d1 )
by Jeroen De
03:37
created

FakeEntityDocument::copy()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
eloc 2
nc 1
nop 0
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
 * @licence GNU GPL v2+
10
 * @author Jeroen De Dauw < [email protected] >
11
 */
12
class FakeEntityDocument implements EntityDocument {
13
14
	/**
15
	 * @var EntityId
16
	 */
17
	private $id;
18
19
	/**
20
	 * @param EntityId $id
21
	 */
22
	public function __construct( EntityId $id ) {
23
		$this->id = $id;
24
	}
25
26
	/**
27
	 * @return EntityId
28
	 */
29
	public function getId() {
30
		return $this->id;
31
	}
32
33
	/**
34
	 * @return string Returns the entity type of the provided EntityId.
35
	 */
36
	public function getType() {
37
		return $this->id->getEntityType();
38
	}
39
40
	/**
41
	 * @param EntityId $id
42
	 */
43
	public function setId( $id ) {
44
		$this->id = $id;
45
	}
46
47
	/**
48
	 * @return bool
49
	 */
50
	public function isEmpty() {
51
		return true;
52
	}
53
54
	/**
55
	 * @see EntityDocument::equals
56
	 *
57
	 * @since 3.3
58
	 *
59
	 * @param mixed $target
60
	 *
61
	 * @return bool Always true.
62
	 */
63
	public function equals( $target ) {
64
		return true;
65
	}
66
67
	/**
68
	 * @see EntityDocument::copy
69
	 *
70
	 * @since 3.3
71
	 *
72
	 * @return self
73
	 */
74
	public function copy() {
75
		return new self( $this->id );
76
	}
77
78
}
79