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.

Completed
Push — develop ( 577635...cd8e32 )
by
unknown
269:51 queued 254:48
created

Issues   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 114
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 8
lcom 1
cbo 2
dl 0
loc 114
ccs 24
cts 24
cp 1
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A all() 0 7 1
A get() 0 6 1
A create() 0 13 3
A update() 0 7 1
A delete() 0 6 1
A comments() 0 4 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;
13
14
use Bitbucket\API;
15
use Bitbucket\API\Repositories;
16
use Buzz\Message\MessageInterface;
17
18
/**
19
 * Provides functionality for interacting with an issue tracker.
20
 *
21
 * @author  Alexandru G.    <[email protected]>
22
 */
23
class Issues extends API\Api
24
{
25
    /**
26
     * GET a list of issues in a repository's tracker
27
     *
28
     * @access public
29
     * @param  string           $account The team or individual account owning the repository.
30
     * @param  string           $repo    The repository identifier.
31
     * @param  array            $options Filtering parameters.
32
     * @return MessageInterface
33
     *
34
     * @see https://confluence.atlassian.com/x/1w2mEQ
35
     */
36 1
    public function all($account, $repo, array $options = array())
37
    {
38 1
        return $this->getClient()->setApiVersion('2.0')->get(
39 1
            sprintf('repositories/%s/%s/issues', $account, $repo),
40 1
            $options
41
        );
42
    }
43
44
    /**
45
     * GET an individual issue
46
     *
47
     * @access public
48
     * @param  string           $account The team or individual account owning the repository.
49
     * @param  string           $repo    The repository identifier.
50
     * @param  int              $issueID The issue identifier.
51
     * @return MessageInterface
52
     */
53 1
    public function get($account, $repo, $issueID)
54
    {
55 1
        return $this->getClient()->setApiVersion('2.0')->get(
56 1
            sprintf('repositories/%s/%s/issues/%d', $account, $repo, $issueID)
57
        );
58
    }
59
60
    /**
61
     * POST a new issue
62
     *
63
     * @access public
64
     * @param  string           $account The team or individual account owning the repository.
65
     * @param  string           $repo    The repository identifier.
66
     * @param  array            $options Issue parameters
67
     * @return MessageInterface
68
     *
69 1
     * @throws \InvalidArgumentException
70
     *
71 1
     * @see https://confluence.atlassian.com/display/BITBUCKET/issues+Resource#issuesResource-POSTanewissue
72 1
     */
73
    public function create($account, $repo, array $options = array())
74
    {
75
        if (!isset($options['title']) || !isset($options['content'])) {
76
            throw new \InvalidArgumentException(
77
                'Arguments: "title" and "content" are mandatory.'
78
            );
79
        }
80
81
        return $this->getClient()->setApiVersion('2.0')->post(
82
            sprintf('repositories/%s/%s/issues', $account, $repo),
83
            $options
84
        );
85
    }
86
87
    /**
88
     * Update existing issue
89 3
     *
90
     * @access public
91 3
     * @param  string           $account The team or individual account owning the repository.
92 2
     * @param  string           $repo    The repository identifier.
93 2
     * @param  int              $issueID The issue identifier.
94
     * @param  array            $options Issue parameters
95
     * @return MessageInterface
96
     *
97 1
     * @see https://confluence.atlassian.com/display/BITBUCKET/issues+Resource#issuesResource-Updateanexistingissue
98 1
     */
99 1
    public function update($account, $repo, $issueID, array $options)
100
    {
101
        return $this->getClient()->setApiVersion('2.0')->put(
102
            sprintf('repositories/%s/%s/issues/%d', $account, $repo, $issueID),
103
            $options
104
        );
105
    }
106
107
    /**
108
     * Delete issue
109
     *
110
     * @access public
111
     * @param  string           $account The team or individual account owning the repository.
112
     * @param  string           $repo    The repository identifier.
113
     * @param  int              $issueID The issue identifier.
114
     * @return MessageInterface
115 1
     */
116
    public function delete($account, $repo, $issueID)
117 1
    {
118 1
        return $this->getClient()->setApiVersion('2.0')->delete(
119 1
            sprintf('repositories/%s/%s/issues/%d', $account, $repo, $issueID)
120
        );
121
    }
122
123
    /**
124
     * Get comments
125
     *
126
     * @access public
127
     * @return Repositories\Issues\Comments
128
     *
129
     * @throws \InvalidArgumentException
130
     * @codeCoverageIgnore
131
     */
132 1
    public function comments()
133
    {
134 1
        return $this->api('Repositories\\Issues\\Comments');
135 1
    }
136
}
137