LarouteServiceProvider::registerCommand()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 15
rs 9.7666
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cortex\Foundation\Overrides\Lord\Laroute;
6
7
use Cortex\Foundation\Overrides\Lord\Laroute\Routes\Collection;
8
use Lord\Laroute\LarouteServiceProvider as BaseLarouteServiceProvider;
9
use Cortex\Foundation\Overrides\Lord\Laroute\Console\Commans\LarouteGeneratorCommand;
10
11
class LarouteServiceProvider extends BaseLarouteServiceProvider
12
{
13
    /**
14
     * Register the command.
15
     *
16
     * @return void
17
     */
18
    protected function registerCommand(): void
19
    {
20
        $this->app->singleton(
21
            'command.laroute.generate',
22
            function ($app) {
23
                $config = $app['config'];
24
                $routes = new Collection($app['router']->getRoutes(), $config->get('laroute.filter', 'all'), $config->get('laroute.action_namespace', ''));
25
                $generator = $app->make('Lord\Laroute\Generators\GeneratorInterface');
26
27
                return new LarouteGeneratorCommand($config, $routes, $generator);
28
            }
29
        );
30
31
        $this->commands('command.laroute.generate');
32
    }
33
}
34