1 | <?php |
||
13 | abstract class AbstractHealthIndicator implements HealthIndicatorInterface |
||
14 | { |
||
15 | 36 | public function health() |
|
16 | { |
||
17 | 36 | $builder = new HealthBuilder(); |
|
18 | try { |
||
19 | 36 | $this->doHealthCheck($builder); |
|
20 | 36 | } catch (\Exception $e) { |
|
21 | 3 | $builder->down($e); |
|
22 | } |
||
23 | |||
24 | 36 | return $builder->build(); |
|
25 | 3 | } |
|
26 | |||
27 | /** |
||
28 | * Actual health check logic. |
||
29 | * |
||
30 | * @param HealthBuilder $builder |
||
31 | * @throws \Exception any Exception that should create a Status::DOWN |
||
32 | * system status. |
||
33 | */ |
||
34 | abstract protected function doHealthCheck(HealthBuilder $builder); |
||
35 | } |
||
36 |