AbstractClient   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 113
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 1 Features 1
Metric Value
wmc 9
c 1
b 1
f 1
lcom 0
cbo 0
dl 0
loc 113
ccs 26
cts 26
cp 1
rs 10

9 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 14 1
A getHttpClient() 0 4 1
A getApiRootUrl() 0 4 1
A getRepresentProcessor() 0 4 1
A getValidationResponse() 0 4 1
A setHttpClient() 0 4 1
A setApiRootUrl() 0 4 1
A setRepresentProcessor() 0 4 1
A setValidationResponse() 0 4 1
1
<?php
2
3
namespace TonicForHealth\PagerDutyClient\Client;
4
5
use Http\Client\Common\HttpMethodsClient;
6
use TonicForHealth\PagerDutyClient\RepresentProcessor\RepresentProcessorInterface;
7
use TonicForHealth\PagerDutyClient\Validation\ValidationResponseInterface;
8
9
/**
10
 * Class AbstractClient.
11
 */
12
abstract class AbstractClient
13
{
14
    /**
15
     * @var array
16
     */
17
    protected $headers = ['Content-type' => 'application/json'];
18
    /**
19
     * @var HttpMethodsClient
20
     */
21
    protected $httpClient;
22
23
    /**
24
     * @var string
25
     */
26
    protected $apiRootUrl;
27
28
    /**
29
     * @var RepresentProcessorInterface
30
     */
31
    protected $representProcessor;
32
33
    /**
34
     * @var ValidationResponseInterface
35
     */
36
    protected $validationResponse;
37
38
    /**
39
     * RequestNotificationType constructor.
40
     *
41
     * @param string                      $apiRootUrl
42
     * @param HttpMethodsClient           $httpClient
43
     * @param RepresentProcessorInterface $representProcessor
44
     * @param ValidationResponseInterface $validationResponse
45
     */
46 4
    public function __construct(
47
        $apiRootUrl,
48
        HttpMethodsClient $httpClient,
49
        RepresentProcessorInterface $representProcessor,
50
        ValidationResponseInterface $validationResponse
51
    ) {
52 4
        $this->setApiRootUrl($apiRootUrl);
53
54 4
        $this->setHttpClient($httpClient);
55
56 4
        $this->setRepresentProcessor($representProcessor);
57
58 4
        $this->setValidationResponse($validationResponse);
59 4
    }
60
61
    /**
62
     * @return HttpMethodsClient
63
     */
64 4
    public function getHttpClient()
65
    {
66 4
        return $this->httpClient;
67
    }
68
69
    /**
70
     * @return string
71
     */
72 4
    public function getApiRootUrl()
73
    {
74 4
        return $this->apiRootUrl;
75
    }
76
77
    /**
78
     * @return RepresentProcessorInterface
79
     */
80 4
    public function getRepresentProcessor()
81
    {
82 4
        return $this->representProcessor;
83
    }
84
85
    /**
86
     * @return ValidationResponseInterface
87
     */
88 3
    public function getValidationResponse()
89
    {
90 3
        return $this->validationResponse;
91
    }
92
93
    /**
94
     * @param HttpMethodsClient $httpClient
95
     */
96 4
    protected function setHttpClient($httpClient)
97
    {
98 4
        $this->httpClient = $httpClient;
99 4
    }
100
101
    /**
102
     * @param string $apiRootUrl
103
     */
104 4
    protected function setApiRootUrl($apiRootUrl)
105
    {
106 4
        $this->apiRootUrl = $apiRootUrl;
107 4
    }
108
109
    /**
110
     * @param RepresentProcessorInterface $representProcessor
111
     */
112 4
    protected function setRepresentProcessor($representProcessor)
113
    {
114 4
        $this->representProcessor = $representProcessor;
115 4
    }
116
117
    /**
118
     * @param ValidationResponseInterface $validationResponse
119
     */
120 4
    protected function setValidationResponse($validationResponse)
121
    {
122 4
        $this->validationResponse = $validationResponse;
123 4
    }
124
}
125