Total Complexity | 7 |
Total Lines | 50 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
9 | class HealthFoundation |
||
10 | { |
||
11 | /** |
||
12 | * @var Check[] |
||
13 | */ |
||
14 | private $registeredChecks = []; |
||
15 | |||
16 | /** |
||
17 | * @var Client |
||
18 | */ |
||
19 | private $httpClient; |
||
20 | |||
21 | public function setHttpClient(Client $httpClient) |
||
22 | { |
||
23 | $this->httpClient = $httpClient; |
||
24 | } |
||
25 | |||
26 | /** |
||
27 | * Return the current httpClient if set otherwise create one. |
||
28 | * |
||
29 | * @return Client |
||
30 | */ |
||
31 | private function getHttpClient() |
||
32 | { |
||
33 | if (!$this->httpClient) { |
||
34 | $this->httpClient = new Client(); |
||
35 | } |
||
36 | |||
37 | return $this->httpClient; |
||
38 | } |
||
39 | |||
40 | public function registerCheck(Check $check, $failOnFail = true) |
||
|
|||
41 | { |
||
42 | if ($check instanceof HttpClientAwareCheck) { |
||
43 | $check->setHttpClient($this->getHttpClient()); |
||
44 | } |
||
45 | $this->registeredChecks[] = $check; |
||
46 | } |
||
47 | |||
48 | public function runHealthCheck() |
||
59 | } |
||
60 | } |
||
61 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.