1 | <?php |
||
2 | |||
3 | /** |
||
4 | * This file is part of web-stack |
||
5 | * |
||
6 | * For the full copyright and license information, please view the LICENSE |
||
7 | * file that was distributed with this source code. |
||
8 | */ |
||
9 | |||
10 | declare(strict_types=1); |
||
11 | |||
12 | namespace Slick\WebStack; |
||
13 | |||
14 | use Dotenv\Dotenv; |
||
15 | use Slick\Di\ContainerInterface; |
||
16 | use Slick\Http\Message\Server\Request; |
||
17 | use Slick\ModuleApi\Infrastructure\AbstractModule; |
||
18 | use Slick\ModuleApi\Infrastructure\Console\ConsoleModuleInterface; |
||
19 | use Slick\ModuleApi\Infrastructure\FrontController\MiddlewareHandler; |
||
20 | use Slick\ModuleApi\Infrastructure\FrontController\MiddlewarePosition; |
||
0 ignored issues
–
show
|
|||
21 | use Slick\ModuleApi\Infrastructure\FrontController\Position; |
||
22 | use Slick\ModuleApi\Infrastructure\FrontController\WebModuleInterface; |
||
23 | use Slick\WebStack\Infrastructure\Console\RouterDebugCommand; |
||
24 | use Slick\WebStack\Infrastructure\Console\RouterDebugMatchCommand; |
||
25 | use Slick\WebStack\Infrastructure\DependencyContainerFactory; |
||
26 | use Slick\WebStack\Infrastructure\Http\DispatcherMiddleware; |
||
0 ignored issues
–
show
The type
Slick\WebStack\Infrastru...tp\DispatcherMiddleware 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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
27 | use Slick\WebStack\Infrastructure\Http\RoutingMiddleware; |
||
28 | use Symfony\Component\Console\Application; |
||
29 | use function Slick\ModuleApi\importSettingsFile; |
||
30 | |||
31 | /** |
||
32 | * DispatcherSlickModule |
||
33 | * |
||
34 | * @package Slick\WebStack |
||
35 | */ |
||
36 | final class DispatcherModule extends AbstractModule implements WebModuleInterface, ConsoleModuleInterface |
||
37 | { |
||
38 | public function description(): string |
||
39 | { |
||
40 | return "Core module that integrates routing and dispatching features as middleware for a web application."; |
||
41 | } |
||
42 | |||
43 | |||
44 | /** |
||
45 | * @inheritDoc |
||
46 | */ |
||
47 | public function services(): array |
||
48 | { |
||
49 | return require dirname(__DIR__) . '/config/routing.php'; |
||
50 | } |
||
51 | |||
52 | /** |
||
53 | * @inheritDoc |
||
54 | */ |
||
55 | public function settings(Dotenv $dotenv): array |
||
56 | { |
||
57 | |||
58 | $settingsFile = APP_ROOT .'/config/modules/dispatcher.php'; |
||
59 | $defaultSettings = [ |
||
60 | 'router' => [ |
||
61 | 'cache' => [ |
||
62 | 'enabled' => true, |
||
63 | 'directory' => sys_get_temp_dir() . '/cache/routes', |
||
64 | ], |
||
65 | 'resources_path' => APP_ROOT . '/src/UserInterface' |
||
66 | ] |
||
67 | ]; |
||
68 | return importSettingsFile($settingsFile, $defaultSettings); |
||
69 | } |
||
70 | |||
71 | /** |
||
72 | * @inheritDoc |
||
73 | */ |
||
74 | public function middlewareHandlers(): array |
||
75 | { |
||
76 | return [ |
||
77 | new MiddlewareHandler('router', new MiddlewarePosition(Position::Top), RoutingMiddleware::class), |
||
78 | new MiddlewareHandler( |
||
79 | 'dispatcher', |
||
80 | new MiddlewarePosition(Position::Before, 'default-response'), |
||
81 | new DispatcherMiddleware(DependencyContainerFactory::instance()->container()) |
||
82 | ), |
||
83 | ]; |
||
84 | } |
||
85 | |||
86 | public function configureConsole(Application $cli, ContainerInterface $container): void |
||
87 | { |
||
88 | $container->register('http.request', new Request('GET', '/')); |
||
89 | $cli->addCommands([ |
||
90 | $container->make(RouterDebugCommand::class), |
||
91 | $container->make(RouterDebugMatchCommand::class), |
||
92 | ]); |
||
93 | } |
||
94 | } |
||
95 |
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:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths