AbstractHealthIndicator   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 2
c 2
b 1
f 0
lcom 0
cbo 1
dl 0
loc 24
ccs 7
cts 7
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A health() 0 11 2
doHealthCheck() 0 1 ?
1
<?php
2
3
namespace Actuator\Health\Indicator;
4
5
use Actuator\Health\HealthBuilder;
6
7
/**
8
 * Base HealthIndicator implementations that encapsulates creation of
9
 * Health instance and error handling.
10
 */
11
abstract class AbstractHealthIndicator implements HealthIndicatorInterface
12
{
13
    public function health()
14
    {
15 36
        $builder = new HealthBuilder();
16
        try {
17 36
            $this->doHealthCheck($builder);
18
        } catch (\Exception $e) {
19 36
            $builder->down($e);
20 36
        }
21 3
22
        return $builder->build();
23
    }
24 36
25 3
    /**
26
     * Actual health check logic.
27
     *
28
     * @param HealthBuilder $builder
29
     *
30
     * @throws \Exception any Exception that should create a Status::DOWN
31
     *                    system status.
32
     */
33
    abstract protected function doHealthCheck(HealthBuilder $builder);
34
}
35