anonymous()
last analyzed

Size

Total Lines 20
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 17
dl 0
loc 20
c 0
b 0
f 0
nc 1
nop 3
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
Unused Code introduced by
The parameter $container 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

38
return function (Application $app, MiddlewareFactory $factory, /** @scrutinizer ignore-unused */ ContainerInterface $container): void {

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...
Unused Code introduced by
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 ignore-unused  annotation

38
return function (Application $app, /** @scrutinizer ignore-unused */ MiddlewareFactory $factory, ContainerInterface $container): void {

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...
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