CompileRoutesCommand   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
lcom 1
cbo 3
dl 0
loc 46
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A handle() 0 5 1
1
<?php
2
3
4
namespace ElementsFramework\DynamicRouting\Console;
5
6
7
use ElementsFramework\DynamicRouting\Service\Compiler\RouteDeclarationCompiler;
8
use Illuminate\Console\Command;
9
10
class CompileRoutesCommand extends Command
11
{
12
    /**
13
     * The name and signature of the console command.
14
     *
15
     * @var string
16
     */
17
    protected $signature = 'dynamic-route:compile';
18
19
    /**
20
     * The console command description.
21
     *
22
     * @var string
23
     */
24
    protected $description = 'Compiles all dynamic routes to a static file.';
25
26
    /**
27
     * The route compiler
28
     *
29
     * @var RouteDeclarationCompiler
30
     */
31
    protected $compiler;
32
33
    /**
34
     * Create a new command instance.
35
     *
36
     * @param RouteDeclarationCompiler $compiler
37
     */
38
    public function __construct(RouteDeclarationCompiler $compiler)
39
    {
40
        parent::__construct();
41
42
        $this->compiler = $compiler;
43
    }
44
45
    /**
46
     * Execute the console command.
47
     *
48
     * @return mixed
49
     */
50
    public function handle()
51
    {
52
        $this->output->writeln('<info>Compiling dynamic routes...</info>');
53
        $this->compiler->compileToFile();
54
    }
55
}