Revision   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 105
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 9
lcom 0
cbo 2
dl 0
loc 105
ccs 26
cts 26
cp 1
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 21 3
A getContent() 0 3 1
A getEditInfo() 0 3 1
A getId() 0 3 1
A getPageIdentifier() 0 3 1
A getUser() 0 3 1
A getTimestamp() 0 3 1
1
<?php
2
3
namespace Mediawiki\DataModel;
4
5
/**
6
 * Representation of a version of content
7
 *
8
 * @author Addshore
9
 */
10
class Revision {
11
12
	/**
13
	 * @var int Id of the revision
14
	 */
15
	private $id;
16
17
	/**
18
	 * @var PageIdentifier of the page for the revision
19
	 */
20
	private $pageIdentifier;
21
22
	/**
23
	 * @var Content
24
	 */
25
	private $content;
26
27
	/**
28
	 * @var EditInfo
29
	 */
30
	private $editInfo;
31
32
	/**
33
	 * @var null|string
34
	 */
35
	private $user;
36
37
	/**
38
	 * @var null|string
39
	 */
40
	private $timestamp;
41
42
	/**
43
	 * @param Content $content
44
	 * @param PageIdentifier|null $pageIdentifier
45
	 * @param int|null $revId
46
	 * @param EditInfo|null $editInfo
47
	 * @param string|null $user
48
	 * @param string|null $timestamp
49 6
	 */
50 6
	public function __construct(
51 3
		Content $content,
52 3
		PageIdentifier $pageIdentifier = null,
53 6
		$revId = null,
54 1
		EditInfo $editInfo = null,
55 1
		$user = null,
56 6
		$timestamp = null
57 6
		) {
58 6
		if ( $editInfo === null ) {
59 6
			$editInfo = new EditInfo();
60 6
		}
61 6
		if ( $pageIdentifier === null ) {
62 6
			$pageIdentifier = new PageIdentifier();
63
		}
64
		$this->content = $content;
65
		$this->pageIdentifier = $pageIdentifier;
66
		$this->id = $revId;
67 6
		$this->editInfo = $editInfo;
68 6
		$this->user = $user;
69
		$this->timestamp = $timestamp;
70
	}
71
72
	/**
73
	 * @return Content
74 6
	 */
75 6
	public function getContent() {
76
		return $this->content;
77
	}
78
79
	/**
80
	 * @return EditInfo
81 6
	 */
82 6
	public function getEditInfo() {
83
		return $this->editInfo;
84
	}
85
86
	/**
87
	 * @return int|null
88 6
	 */
89 6
	public function getId() {
90
		return $this->id;
91
	}
92
93
	/**
94
	 * @return PageIdentifier|null
95 6
	 */
96 6
	public function getPageIdentifier() {
97
		return $this->pageIdentifier;
98
	}
99
100
	/**
101
	 * @return null|string
102 6
	 */
103 6
	public function getUser() {
104
		return $this->user;
105
	}
106
107
	/**
108
	 * @return null|string
109
	 */
110
	public function getTimestamp() {
111
		return $this->timestamp;
112
	}
113
114
}
115