OnCallsRepository   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A get() 0 7 1
A users() 0 8 1
1
<?php
2
3
namespace Shrikeh\PagerDuty\Repository\OnCalls;
4
5
use Shrikeh\PagerDuty\Client;
6
use Shrikeh\PagerDuty\Parser;
7
use Shrikeh\PagerDuty\Repository\OnCalls;
8
use Shrikeh\PagerDuty\Parser\OnCall as OnCallParser;
9
10
class OnCallsRepository implements OnCalls
11
{
12
    private $client;
13
14
    private $parser;
15
16
    public function __construct(
17
        Client $client,
18
        OnCallParser $parser
19
    ) {
20
        $this->client   = $client;
21
        $this->parser   = $parser;
22
    }
23
24
    public function get()
25
    {
26
        return $this->parser->parseResponse($this->client->request(
27
            'GET',
28
            static::ENDPOINT
29
        ));
30
    }
31
32
    public function users()
33
    {
34
      return $this->parser->parseResponse($this->client->request(
35
          'GET',
36
          static::ENDPOINT,
37
          ['query' => 'include[]=users']
38
      ));
39
    }
40
}
41