1 | <?php |
||||
2 | |||||
3 | declare(strict_types=1); |
||||
4 | |||||
5 | use Ecodev\Felix\Handler\GraphQLHandler; |
||||
6 | use GraphQL\Upload\UploadMiddleware; |
||||
7 | use Mezzio\Application; |
||||
8 | use Mezzio\Helper\BodyParams\BodyParamsMiddleware; |
||||
9 | use Mezzio\MiddlewareFactory; |
||||
10 | use Psr\Container\ContainerInterface; |
||||
11 | |||||
12 | /* |
||||
13 | * Setup routes with a single request method: |
||||
14 | * |
||||
15 | * $app->get('/', App\Handler\HomePageHandler::class, 'home'); |
||||
16 | * $app->post('/album', App\Handler\AlbumCreateHandler::class, 'album.create'); |
||||
17 | * $app->put('/album/:id', App\Handler\AlbumUpdateHandler::class, 'album.put'); |
||||
18 | * $app->patch('/album/:id', App\Handler\AlbumUpdateHandler::class, 'album.patch'); |
||||
19 | * $app->delete('/album/:id', App\Handler\AlbumDeleteHandler::class, 'album.delete'); |
||||
20 | * |
||||
21 | * Or with multiple request methods: |
||||
22 | * |
||||
23 | * $app->route('/contact', App\Handler\ContactHandler::class, ['GET', 'POST', ...], 'contact'); |
||||
24 | * |
||||
25 | * Or handling all request methods: |
||||
26 | * |
||||
27 | * $app->route('/contact', App\Handler\ContactHandler::class)->setName('contact'); |
||||
28 | * |
||||
29 | * or: |
||||
30 | * |
||||
31 | * $app->route( |
||||
32 | * '/contact', |
||||
33 | * App\Handler\ContactHandler::class, |
||||
34 | * Mezzio\Router\Route::HTTP_METHOD_ANY, |
||||
35 | * 'contact' |
||||
36 | * ); |
||||
37 | */ |
||||
38 | return function (Application $app, MiddlewareFactory $factory, ContainerInterface $container): void { |
||||
0 ignored issues
–
show
The parameter
$factory 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
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. ![]() |
|||||
39 | $app->post('/graphql', [ |
||||
40 | Ecodev\Felix\Middleware\SignedQueryMiddleware::class, |
||||
41 | BodyParamsMiddleware::class, |
||||
42 | UploadMiddleware::class, |
||||
43 | GraphQLHandler::class, |
||||
44 | ], 'graphql'); |
||||
45 | |||||
46 | $app->get('/api/image/{id:\d+}[/{maxHeight:\d+}]', [ |
||||
47 | Ecodev\Felix\Handler\ImageHandler::class, |
||||
48 | ], 'image'); |
||||
49 | |||||
50 | $app->get('/api/accounting-document/{id:\d+}', [ |
||||
51 | \Application\Handler\AccountingDocumentHandler::class, |
||||
52 | ], 'accounting-document'); |
||||
53 | |||||
54 | $app->post('/api/datatrans', [ |
||||
55 | BodyParamsMiddleware::class, |
||||
56 | \Application\Handler\DatatransHandler::class, |
||||
57 | ], 'datatrans'); |
||||
58 | }; |
||||
59 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.