1
|
|
|
<?php |
2
|
|
|
namespace DevBoardLib\GithubCore\Commit; |
3
|
|
|
|
4
|
|
|
use DateTime; |
5
|
|
|
use DevBoardLib\GithubCore\Repo\GithubRepo; |
6
|
|
|
use DevBoardLib\GithubCore\Repo\GithubRepoId; |
7
|
|
|
use DevBoardLib\GithubCore\User\GithubUser; |
8
|
|
|
use DevBoardLib\GithubCore\User\GithubUserId; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* Class GithubCommitSource. |
12
|
|
|
*/ |
13
|
|
|
class GithubCommitSource implements GithubCommit |
14
|
|
|
{ |
15
|
|
|
/** @var GithubCommitId */ |
16
|
|
|
protected $id; |
17
|
|
|
|
18
|
|
|
/** @var GithubRepo */ |
19
|
|
|
protected $repo; |
20
|
|
|
|
21
|
|
|
/** @var GithubCommitSha */ |
22
|
|
|
private $sha; |
23
|
|
|
|
24
|
|
|
/** @var GithubUser */ |
25
|
|
|
private $author; |
26
|
|
|
|
27
|
|
|
/** @var DateTime */ |
28
|
|
|
private $authorDate; |
29
|
|
|
|
30
|
|
|
/** @var GithubUser */ |
31
|
|
|
private $committer; |
32
|
|
|
|
33
|
|
|
/** @var DateTime */ |
34
|
|
|
private $committerDate; |
35
|
|
|
|
36
|
|
|
/** @var string */ |
37
|
|
|
private $message; |
38
|
|
|
|
39
|
|
|
/** @var string */ |
40
|
|
|
private $githubCommitState; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* GithubCommitSource constructor. |
44
|
|
|
* |
45
|
|
|
* @param GithubCommitId $id |
46
|
|
|
* @param GithubRepo $repo |
47
|
|
|
* @param GithubCommitSha $sha |
48
|
|
|
* @param GithubUser $author |
49
|
|
|
* @param DateTime $authorDate |
50
|
|
|
* @param GithubUser $committer |
51
|
|
|
* @param DateTime $committerDate |
52
|
|
|
* @param string $message |
53
|
|
|
* @param string $githubCommitState |
54
|
|
|
*/ |
55
|
|
|
public function __construct( |
56
|
|
|
GithubCommitId $id, |
57
|
|
|
GithubRepo $repo, |
58
|
|
|
GithubCommitSha $sha, |
59
|
|
|
GithubUser $author, |
60
|
|
|
DateTime $authorDate, |
61
|
|
|
GithubUser $committer, |
62
|
|
|
DateTime $committerDate, |
63
|
|
|
$message, |
64
|
|
|
$githubCommitState = null |
65
|
|
|
) { |
66
|
|
|
$this->id = $id; |
67
|
|
|
$this->repo = $repo; |
68
|
|
|
$this->sha = $sha; |
69
|
|
|
$this->author = $author; |
70
|
|
|
$this->authorDate = $authorDate; |
71
|
|
|
$this->committer = $committer; |
72
|
|
|
$this->committerDate = $committerDate; |
73
|
|
|
$this->message = $message; |
74
|
|
|
$this->githubCommitState = $githubCommitState; |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
/** @return GithubCommitId */ |
78
|
|
|
public function getId() |
79
|
|
|
{ |
80
|
|
|
return $this->id; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** @return GithubRepoId */ |
84
|
|
|
public function getRepoId() |
85
|
|
|
{ |
86
|
|
|
return $this->repo->getId(); |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
/** @return GithubRepo */ |
90
|
|
|
public function getRepo() |
91
|
|
|
{ |
92
|
|
|
return $this->repo; |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
/** @return GithubCommitSha */ |
96
|
|
|
public function getSha() |
97
|
|
|
{ |
98
|
|
|
return $this->sha; |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
/** @return GithubUserId */ |
102
|
|
|
public function getAuthorId() |
103
|
|
|
{ |
104
|
|
|
return $this->author->getGithubUserId(); |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
/** @return GithubUser */ |
108
|
|
|
public function getAuthor() |
109
|
|
|
{ |
110
|
|
|
return $this->author; |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
/** @return DateTime */ |
114
|
|
|
public function getAuthorDate() |
115
|
|
|
{ |
116
|
|
|
return $this->authorDate; |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
/** @return GithubUserId */ |
120
|
|
|
public function getCommitterId() |
121
|
|
|
{ |
122
|
|
|
return $this->committer->getGithubUserId(); |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
/** @return GithubUser */ |
126
|
|
|
public function getCommitter() |
127
|
|
|
{ |
128
|
|
|
return $this->committer; |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
/** @return DateTime */ |
132
|
|
|
public function getCommitterDate() |
133
|
|
|
{ |
134
|
|
|
return $this->committerDate; |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
/** @return string */ |
138
|
|
|
public function getMessage() |
139
|
|
|
{ |
140
|
|
|
return $this->message; |
141
|
|
|
} |
142
|
|
|
|
143
|
|
|
/** @return string */ |
144
|
|
|
public function getGithubCommitState() |
145
|
|
|
{ |
146
|
|
|
return $this->githubCommitState; |
147
|
|
|
} |
148
|
|
|
} |
149
|
|
|
|