Repository navigation
Expand file tree
/
Copy pathCommit.php
More file actions
58 lines (46 loc) · 1.36 KB
/
Copy pathCommit.php
File metadata and controls
58 lines (46 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
namespace Gitlab\Model;
use Gitlab\Client;
class Commit extends AbstractModel
{
protected static $_properties = array(
'id',
'short_id',
'parents',
'tree',
'title',
'message',
'author',
'author_name',
'author_email',
'committer',
'authored_date',
'committed_date',
'created_at',
'project'
);
public static function fromArray(Client $client, Project $project, array $data)
{
$commit = new Commit($project, $data['id'], $client);
if (isset($data['parents'])) {
$parents = array();
foreach ($data['parents'] as $parent) {
$parents[] = Commit::fromArray($client, $project, $parent);
}
$data['parents'] = $parents;
}
if (isset($data['author'])) {
$data['author'] = User::fromArray($client, $data['author']);
}
if (isset($data['committer'])) {
$data['committer'] = User::fromArray($client, $data['committer']);
}
return $commit->hydrate($data);
}
public function __construct(Project $project, $id = null, Client $client = null)
{
$this->setClient($client);
$this->project = $project;
$this->id = $id;
}
}