Repository navigation
Expand file tree
/
Copy pathReviewComment.php
More file actions
76 lines (63 loc) · 1.82 KB
/
Copy pathReviewComment.php
File metadata and controls
76 lines (63 loc) · 1.82 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
66
67
68
69
70
71
72
73
74
75
76
<?php
namespace Github\Model;
class ReviewComment extends AbstractModel implements CommentInterface
{
protected static $_properties = array(
'pull_request',
'id',
'url',
'body',
'path',
'position',
'commit_id',
'user',
'created_at',
'updated_at',
'_links'
);
public static function factory(PullRequest $pull_request, $id)
{
return new PullRequest($pull_request, $id);
}
public static function fromArray(PullRequest $pull_request, array $data)
{
$comment = ReviewComment::factory($pull_request, $data['id']);
if (isset($data['user'])) {
$data['user'] = User::fromArray($data['user']);
}
return $comment->hydrate($data);
}
public function __construct(PullRequest $pull_request, $id)
{
$this->id = $id;
$this->pull_request = $pull_request;
}
public function show()
{
$data = $this->api('pull_request')->comments()->show(
$this->pull_request->repo->owner->login,
$this->pull_request->repo->name,
$this->id
);
return ReviewComment::fromArray($this->pull_request, $data);
}
public function update($body)
{
$data = $this->api('pull_request')->comments()->update(
$this->pull_request->repo->owner->login,
$this->pull_request->repo->name,
$this->id,
array('body' => $body)
);
return ReviewComment::fromArray($this->pull_request, $data);
}
public function remove()
{
$this->api('pull_request')->comments()->remove(
$this->pull_request->repo->owner->login,
$this->pull_request->repo->name,
$this->id
);
return true;
}
}