LarouteServiceProvider   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 4
dl 0
loc 23
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A registerCommand() 0 15 1
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