Completed
Push — main ( 1f6f71...689fbc )
by
unknown
04:30
created

Revision::getId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Addwiki\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
	 */
50
	public function __construct(
51
		Content $content,
52
		PageIdentifier $pageIdentifier = null,
53
		$revId = null,
54
		EditInfo $editInfo = null,
55
		$user = null,
56
		$timestamp = null
57
		) {
58
		if ( $editInfo === null ) {
59
			$editInfo = new EditInfo();
60
		}
61
		if ( $pageIdentifier === null ) {
62
			$pageIdentifier = new PageIdentifier();
63
		}
64
		$this->content = $content;
65
		$this->pageIdentifier = $pageIdentifier;
66
		$this->id = $revId;
67
		$this->editInfo = $editInfo;
68
		$this->user = $user;
69
		$this->timestamp = $timestamp;
70
	}
71
72
	/**
73
	 * @return Content
74
	 */
75
	public function getContent() {
76
		return $this->content;
77
	}
78
79
	/**
80
	 * @return EditInfo
81
	 */
82
	public function getEditInfo() {
83
		return $this->editInfo;
84
	}
85
86
	/**
87
	 * @return int|null
88
	 */
89
	public function getId() {
90
		return $this->id;
91
	}
92
93
	/**
94
	 * @return PageIdentifier|null
95
	 */
96
	public function getPageIdentifier() {
97
		return $this->pageIdentifier;
98
	}
99
100
	/**
101
	 * @return null|string
102
	 */
103
	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