Assignees   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 37
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A listAssignees() 0 6 1
A checkAssignee() 0 11 2
1
<?php
2
namespace FlexyProject\GitHub\Receiver\Issues;
3
4
/**
5
 * The Trees API class provides access to Issues's assignees.
6
 *
7
 * @link    https://developer.github.com/v3/issues/assignees/
8
 * @package FlexyProject\GitHub\Receiver\Issues
9
 */
10
class Assignees extends AbstractIssues
11
{
12
13
    /**
14
     * List assignees
15
     *
16
     * @link https://developer.github.com/v3/issues/assignees/#list-assignees
17
     * @return array
18
     */
19
    public function listAssignees(): array
20
    {
21
        return $this->getApi()->request($this->getApi()
22
                                             ->sprintf('/repos/:owner/:repo/assignees', $this->getIssues()->getOwner(),
23
                                                 $this->getIssues()->getRepo()));
24
    }
25
26
    /**
27
     * Check assignee
28
     *
29
     * @link  https://developer.github.com/v3/issues/assignees/#check-assignee
30
     *
31
     * @param string $assignee
32
     *
33
     * @return bool
34
     */
35
    public function checkAssignee(string $assignee): bool
36
    {
37
        $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/assignees/:assignee',
38
            $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $assignee));
39
40
        if ($this->getApi()->getHeaders()['Status'] == '204 No Content') {
41
            return true;
42
        }
43
44
        return false;
45
    }
46
}