Repository navigation
Expand file tree
/
Copy pathNote.php
More file actions
58 lines (52 loc) · 1.28 KB
/
Copy pathNote.php
File metadata and controls
58 lines (52 loc) · 1.28 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 Note
*
* @property-read User $author
* @property-read string $body
* @property-read string $created_at
* @property-read string $updated_at
* @property-read string $parent_type
* @property-read Issue|MergeRequest $parent
* @property-read string $attachment
*/
class Note extends AbstractModel
{
/**
* @var array
*/
protected static $properties = array(
'author',
'body',
'created_at',
'updated_at',
'parent_type',
'parent',
'attachment'
);
/**
* @param Client $client
* @param Noteable $type
* @param array $data
* @return mixed
*/
public static function fromArray(Client $client, Noteable $type, array $data)
{
$comment = new static($type, $client);
if (isset($data['author'])) {
$data['author'] = User::fromArray($client, $data['author']);
}
return $comment->hydrate($data);
}
/**
* @param Noteable $type
* @param Client $client
*/
public function __construct(Noteable $type, Client $client = null)
{
$this->setClient($client);
$this->setData('parent_type', get_class($type));
$this->setData('parent', $type);
}
}