Issues (2)

src/Controllers/HealthController.php (1 issue)

Severity
1
<?php
2
namespace Health\Controllers;
3
4
use Illuminate\Routing\Controller;
5
use Health\Services\HealthService;
6
use Symfony\Component\HttpFoundation\Request;
7
use Health\Resources\Health;
8
use Illuminate\Http\Response;
9
10
/**
11
 * Health Check Controler
12
 */
13
class HealthController extends Controller
14
{
15
16
    /**
17
     *
18
     * @var HealthService
19
     */
20
    private $healthService;
21
22
    /**
23
     *
24
     * @param HealthService $healthService
25
     */
26
    public function __construct(HealthService $healthService)
27
    {
28
        $this->healthService = $healthService;
29
    }
30
31
    /**
32
     *
33
     * @param Request $request
34
     * @return \Illuminate\Http\JsonResponse
35
     */
36
    public function check(Request $request)
0 ignored issues
show
The parameter $request is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

36
    public function check(/** @scrutinizer ignore-unused */ Request $request)

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

Loading history...
37
    {
38
        $health = $this->healthService->getHealth(config('health.checks', []));
39
40
        $statusCode = $health->isOk() ? Response::HTTP_OK : Response::HTTP_SERVICE_UNAVAILABLE;
41
42
        $response = new Health($health);
43
        $response->withoutWrapping();
44
45
        return $response->response()->setStatusCode($statusCode);
46
    }
47
}
48