Completed
Push — master ( 895971...6bd885 )
by John
14:20
created

HealthController::__invoke()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 15
Code Lines 9

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 15
rs 9.4285
cc 2
eloc 9
nc 2
nop 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
    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
        $healthAggregator = $app['health.aggregator'];
14
        $healthIndicators = $app['health.indicators'];
15
16
        assert(!is_null($healthAggregator), "health.aggregator must not be null");
17
        assert(!is_null($healthIndicators), "health.indicators must not be null");
18
19
        $healthIndicator = new CompositeHealthIndicator($healthAggregator);
20
        foreach ($healthIndicators as $key => $entry) {
21
            $healthIndicator->addHealthIndicator($key, $entry);
22
        }
23
24
        return $healthIndicator->health();
25
    }
26
}
27