Repository navigation
Expand file tree
/
Copy pathEvent.php
More file actions
65 lines (59 loc) · 1.45 KB
/
Copy pathEvent.php
File metadata and controls
65 lines (59 loc) · 1.45 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
59
60
61
62
63
64
65
<?php namespace Gitlab\Model;
use Gitlab\Client;
/**
* Class Event
*
* @property-read string $title
* @property-read int $id
* @property-read string $action_name
* @property-read string $data
* @property-read int $target_id
* @property-read string $target_type
* @property-read string $target_title
* @property-read int $author_id
* @property-read string $author_username
* @property-read User $author
* @property-read Project $project
*/
class Event extends AbstractModel
{
/**
* @var array
*/
protected static $properties = array(
'title',
'project_id',
'action_name',
'target_id',
'target_type',
'author_id',
'author_username',
'data',
'target_title',
'author',
'project'
);
/**
* @param Client $client
* @param Project $project
* @param array $data
* @return Event
*/
public static function fromArray(Client $client, Project $project, array $data)
{
$event = new static($project, $client);
if (isset($data['author_id'])) {
$data['author'] = new User($data['author_id'], $client);
}
return $event->hydrate($data);
}
/**
* @param Project $project
* @param Client $client
*/
public function __construct(Project $project, Client $client = null)
{
$this->setClient($client);
$this->setData('project', $project);
}
}