RoutesBootloader   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 14
c 1
b 0
f 0
dl 0
loc 40
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A globalMiddleware() 0 12 1
A middlewareGroups() 0 11 1
A defineRoutes() 0 2 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Application\Bootloader;
6
7
use GraphQL\Upload\UploadMiddleware;
0 ignored issues
show
Bug introduced by
The type GraphQL\Upload\UploadMiddleware was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use Spiral\Bootloader\Http\RoutesBootloader as BaseRoutesBootloader;
0 ignored issues
show
Bug introduced by
The type Spiral\Bootloader\Http\RoutesBootloader was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
use Spiral\Cookies\Middleware\CookiesMiddleware;
0 ignored issues
show
Bug introduced by
The type Spiral\Cookies\Middleware\CookiesMiddleware was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
use Spiral\Csrf\Middleware\CsrfMiddleware;
0 ignored issues
show
Bug introduced by
The type Spiral\Csrf\Middleware\CsrfMiddleware was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use Spiral\Debug\StateCollector\HttpCollector;
0 ignored issues
show
Bug introduced by
The type Spiral\Debug\StateCollector\HttpCollector was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
use Spiral\Http\Middleware\ErrorHandlerMiddleware;
0 ignored issues
show
Bug introduced by
The type Spiral\Http\Middleware\ErrorHandlerMiddleware was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
13
use Spiral\Http\Middleware\JsonPayloadMiddleware;
0 ignored issues
show
Bug introduced by
The type Spiral\Http\Middleware\JsonPayloadMiddleware was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
14
use Spiral\Router\Bootloader\AnnotatedRoutesBootloader;
0 ignored issues
show
Bug introduced by
The type Spiral\Router\Bootloader\AnnotatedRoutesBootloader was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
15
use Spiral\Router\Loader\Configurator\RoutingConfigurator;
0 ignored issues
show
Bug introduced by
The type Spiral\Router\Loader\Con...tor\RoutingConfigurator was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
16
use Spiral\Session\Middleware\SessionMiddleware;
0 ignored issues
show
Bug introduced by
The type Spiral\Session\Middleware\SessionMiddleware was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
17
18
/**
19
 * A bootloader that configures the application's routes and middleware.
20
 *
21
 * @link https://spiral.dev/docs/http-routing
22
 */
23
final class RoutesBootloader extends BaseRoutesBootloader
24
{
25
    protected const DEPENDENCIES = [
26
        AnnotatedRoutesBootloader::class,
27
    ];
28
29
    protected function globalMiddleware(): array
30
    {
31
        return [
32
            // If you want to automatically detect the user's locale based on the
33
            // "Accept-Language" header uncomment this middleware and add \Spiral\Bootloader\I18nBootloader
34
            // to the Kernel
35
            // LocaleSelector::class,
36
37
            ErrorHandlerMiddleware::class,
38
            JsonPayloadMiddleware::class,
39
            UploadMiddleware::class,
40
            HttpCollector::class,
41
        ];
42
    }
43
44
    protected function middlewareGroups(): array
45
    {
46
        return [
47
            'web' => [
48
                CookiesMiddleware::class,
49
                SessionMiddleware::class,
50
                CsrfMiddleware::class,
51
                // Uncomment this middleware if you want to authenticate users using cookies
52
                // new Autowire(AuthTransportMiddleware::class, ['transportName' => 'cookie'])
53
            ],
54
            'api' => [
55
                // Uncomment this middleware if you want to authenticate users using headers
56
                // new Autowire(AuthTransportMiddleware::class, ['transportName' => 'header'])
57
            ],
58
        ];
59
    }
60
61
    protected function defineRoutes(RoutingConfigurator $routes): void
62
    {
63
        // Fallback route if no other route matched
64
        // Will show 404 page
65
        // $routes->default('/<path:.*>')
66
        //    ->callable(function (ServerRequestInterface $r, ResponseInterface $response) {
67
        //        return $response->withStatus(404)->withBody('Not found');
68
        //    });
69
    }
70
}
71