HealthController   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 18
ccs 10
cts 10
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 15 2
1
<?php
2
3
namespace Actuator\Silex\Controller;
4
5
use Silex\Application;
6
use Actuator\Health\Indicator\CompositeHealthIndicator;
7
use Symfony\Component\HttpFoundation\Request;
8
9
class HealthController
10
{
11 3
    public function __invoke(Application $app, Request $request)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
12
    {
13 3
        $healthAggregator = $app['health.aggregator'];
14 3
        $healthIndicators = $app['health.indicators'];
15
16 3
        assert(!is_null($healthAggregator), "health.aggregator must not be null");
17 3
        assert(!is_null($healthIndicators), "health.indicators must not be null");
18
19 3
        $healthIndicator = new CompositeHealthIndicator($healthAggregator);
20 3
        foreach ($healthIndicators as $key => $entry) {
21 3
            $healthIndicator->addHealthIndicator($key, $entry);
22 3
        }
23
24 3
        return $healthIndicator->health();
25
    }
26
}
27