CompileRoutesCommand::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 6
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 3
nc 1
nop 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
}