Events::listRepositoryEvents()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 5
Ratio 100 %

Importance

Changes 0
Metric Value
dl 5
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
namespace FlexyProject\GitHub\Receiver\Issues;
3
4
/**
5
 * The Trees API class provides access to Issues's events.
6
 *
7
 * @link    https://developer.github.com/v3/issues/events/
8
 * @package FlexyProject\GitHub\Receiver\Issues
9
 */
10 View Code Duplication
class Events extends AbstractIssues
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
11
{
12
13
    /**
14
     * List events for an issue
15
     *
16
     * @link https://developer.github.com/v3/issues/events/#list-events-for-an-issue
17
     *
18
     * @param int $issueNumber
19
     *
20
     * @return array
21
     */
22
    public function listIssueEvents(int $issueNumber): array
23
    {
24
        return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/:issue_number/events',
25
            $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $issueNumber));
26
    }
27
28
    /**
29
     * List events for a repository
30
     *
31
     * @link https://developer.github.com/v3/issues/events/#list-events-for-a-repository
32
     * @return array
33
     */
34
    public function listRepositoryEvents(): array
35
    {
36
        return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/events',
37
            $this->getIssues()->getOwner(), $this->getIssues()->getRepo()));
38
    }
39
40
    /**
41
     * Get a single event
42
     *
43
     * @link https://developer.github.com/v3/issues/events/#get-a-single-event
44
     *
45
     * @param int $id
46
     *
47
     * @return array
48
     */
49
    public function getEvent(int $id): array
50
    {
51
        return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/events/:id',
52
            $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $id));
53
    }
54
}