|
1
|
|
|
<?php declare(strict_types=1); |
|
2
|
|
|
/** |
|
3
|
|
|
* This file is part of the daikon-cqrs/boot project. |
|
4
|
|
|
* |
|
5
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
6
|
|
|
* file that was distributed with this source code. |
|
7
|
|
|
*/ |
|
8
|
|
|
|
|
9
|
|
|
namespace Daikon\Boot\Console\Command; |
|
10
|
|
|
|
|
11
|
|
|
use Aura\Router\RouterContainer; |
|
12
|
|
|
use Closure; |
|
13
|
|
|
use Daikon\Boot\Middleware\RoutingHandler; |
|
14
|
|
|
use Symfony\Component\Console\Command\Command; |
|
|
|
|
|
|
15
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
|
16
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
|
17
|
|
|
|
|
18
|
|
|
class ListRoutes extends Command |
|
19
|
|
|
{ |
|
20
|
|
|
private RoutingHandler $routingHandler; |
|
21
|
|
|
|
|
22
|
|
|
public function __construct(RoutingHandler $routingHandler) |
|
23
|
|
|
{ |
|
24
|
|
|
$this->routingHandler = $routingHandler; |
|
25
|
|
|
|
|
26
|
|
|
parent::__construct(); |
|
27
|
|
|
} |
|
28
|
|
|
|
|
29
|
|
|
protected function configure(): void |
|
30
|
|
|
{ |
|
31
|
|
|
$this |
|
32
|
|
|
->setName('route:ls') |
|
33
|
|
|
->setDescription('List registered routes.'); |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
protected function execute(InputInterface $input, OutputInterface $output): int |
|
37
|
|
|
{ |
|
38
|
|
|
/** @var Closure $getRouter */ |
|
39
|
|
|
$getRouter = Closure::bind( |
|
40
|
|
|
function (RoutingHandler $routingHandler): RouterContainer { |
|
41
|
|
|
/** @psalm-suppress InaccessibleProperty */ |
|
42
|
|
|
return $routingHandler->router; |
|
|
|
|
|
|
43
|
|
|
}, |
|
44
|
|
|
null, |
|
45
|
|
|
$this->routingHandler |
|
46
|
|
|
); |
|
47
|
|
|
|
|
48
|
|
|
foreach ($getRouter($this->routingHandler)->getMap()->getRoutes() as $route) { |
|
49
|
|
|
$output->write("<info>$route->name</info> => "); |
|
50
|
|
|
$output->write('<comment>'.implode('|', $route->allows).'</comment> '); |
|
51
|
|
|
$output->writeln($route->path); |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
return 0; |
|
55
|
|
|
} |
|
56
|
|
|
} |
|
57
|
|
|
|
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