Issues (2)

src/SeedApp/Controllers/DefaultController.php (1 issue)

1
<?php
2
3
namespace SeedApp\Controllers;
4
5
use Psr\Http\Message\RequestInterface;
6
use Slim\Http\Response;
7
use RedBeanPHP\R;
8
use SlimX\Controllers\AbstractController as AbstractXController;
9
use SlimX\Controllers\Action;
10
use SlimX\Exceptions\ErrorCodeException;
11
12
class DefaultController extends AbstractXController
13
{
14
    protected $logger;
15
16
    public function loadActions()
17
    {
18
        $handleWrongApi = [$this, 'handleApiVersionNotSpecified'];
19
20
        $this->pushEntrypoint(new Action(
21
            'GET',
22
            '/',
23
            ['application/vnd.seedapp.v1+json' => [$this, 'indexAction']],
24
            $handleWrongApi
25
        ));
26
    }
27
28
    public function handleApiVersionNotSpecified(Response $response): Response
29
    {
30
        return $this->container->get('error')->handle($response, 1000);
31
    }
32
33
    public function indexAction(
34
        RequestInterface $request,
35
        Response $response,
36
        array $args
0 ignored issues
show
The parameter $args 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
        /** @scrutinizer ignore-unused */ array $args

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
        $logger = $this->app->getContainer()->get('log');
39
        $logger->info('indexAction init');
40
        $response->write(json_encode(['pong']));
41
42
        return $response;
43
    }
44
}
45