Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
HealthCheckController
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
2 / 2
3
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 index
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
2
1<?php
2
3namespace App\Http\Controllers;
4
5use App\Http\Services\Admin\SystemDashboard\SystemHealthService;
6
7class HealthCheckController extends Controller
8{
9    public function __construct(
10        private SystemHealthService $service
11    ) {}
12
13    public function index()
14    {
15        $statuses = $this->service->collect();
16        $httpStatus = ($statuses['application']['status'] === 'OK') ? 200 : 207;
17
18        return response()->json($statuses, $httpStatus);
19    }
20}