Notification Setup Error

We have detected an error in your notification set-up (Event-ID dab39dc24f564ec7bd4628d1305fd03c). Currently, we cannot inform you about inspection progress. Please check that the user 557058:bca11929-8c2d-43f2-8a82-c5416880d395 still has access to your repository or update the API account.

Comments   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 76
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 76
ccs 14
cts 14
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A all() 0 6 1
A get() 0 6 1
A create() 0 8 1
A update() 0 8 1
1
<?php
2
3
/**
4
 * This file is part of the bitbucket-api package.
5
 *
6
 * (c) Alexandru G. <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Bitbucket\API\Repositories\Issues;
13
14
use Bitbucket\API;
15
use Psr\Http\Message\ResponseInterface;
16
17
/**
18
 * @author  Alexandru G.    <[email protected]>
19
 */
20
class Comments extends API\Api
21
{
22
    /**
23
     * Get all comments for specified issue
24
     *
25
     * Comments are returned in DESC order by posted date.
26
     *
27
     * @access public
28
     * @param  string           $account The team or individual account owning the repository.
29
     * @param  string           $repo    The repository identifier.
30
     * @param  int              $issueID The issue identifier.
31
     * @return ResponseInterface
32
     */
33 1
    public function all($account, $repo, $issueID)
34
    {
35 1
        return $this->getClient()->setApiVersion('2.0')->get(
36 1
            sprintf('/repositories/%s/%s/issues/%d/comments', $account, $repo, $issueID)
37
        );
38
    }
39
40
    /**
41
     * Get an individual comment for specified issue
42
     *
43
     * @access public
44
     * @param  string           $account   The team or individual account owning the repository.
45
     * @param  string           $repo      The repository identifier.
46
     * @param  int              $issueID   The issue identifier.
47
     * @param  int              $commentID The comment identifier.
48
     * @return ResponseInterface
49
     */
50 1
    public function get($account, $repo, $issueID, $commentID)
51
    {
52 1
        return $this->getClient()->setApiVersion('2.0')->get(
53 1
            sprintf('/repositories/%s/%s/issues/%d/comments/%d', $account, $repo, $issueID, $commentID)
54
        );
55
    }
56
57
    /**
58
     * Add a new comment to specified issue
59
     *
60
     * @access public
61
     * @param  string           $account The team or individual account owning the repository.
62
     * @param  string           $repo    The repository identifier.
63
     * @param  int              $issueID The issue identifier.
64
     * @param  array            $content The comment.
65
     * @return ResponseInterface
66
     */
67 1
    public function create($account, $repo, $issueID, $content)
68
    {
69 1
        return $this->getClient()->setApiVersion('2.0')->post(
70 1
            sprintf('/repositories/%s/%s/issues/%d/comments', $account, $repo, $issueID),
71 1
            ['content' => $content],
72
            ['Content-Type' => 'application/json']
73
        );
74
    }
75
76
    /**
77
     * Update an existing comment to specified issue
78
     *
79
     * @access public
80
     * @param  string           $account   The team or individual account owning the repository.
81
     * @param  string           $repo      The repository identifier.
82
     * @param  int              $issueID   The issue identifier.
83
     * @param  array            $content   The comment.
84
     * @param  int              $commentID The comment identifier.
85
     * @return ResponseInterface
86 1
     */
87
    public function update($account, $repo, $issueID, $commentID, $content)
88 1
    {
89 1
        return $this->getClient()->setApiVersion('2.0')->put(
90 1
            sprintf('/repositories/%s/%s/issues/%d/comments/%d', $account, $repo, $issueID, $commentID),
91
            ['content' => $content],
92
            ['Content-Type' => 'application/json']
93
        );
94
    }
95
}
96