Completed
Push — master ( fc3d6f...f7b1d9 )
by Sergi Tur
28:05
created

MakeV   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 49
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 1
dl 49
loc 49
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 4 4 1
A handle() 5 5 1
A command() 9 9 3

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace Acacha\AdminLTETemplateLaravel\Console;
4
5
use Illuminate\Console\Command;
6
7
/**
8
 * Class MakeV.
9
 */
10 View Code Duplication
class MakeV extends Command
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
11
{
12
13
    /**
14
     * The name and signature of the console command.
15
     */
16
    protected $signature = 'make:v {link : The route link} {action? : View to create} 
17
    {--t|type=regular : Type of route to create (regular,controller,resource)} {--m|method=get : HTTP method} 
18
    {--api : Route is an api route}';
19
20
    /**
21
     * The console command description.
22
     *
23
     * @var string
24
     */
25
    protected $description = 'Create a view with his corresponding route and menu entry';
26
27
    /**
28
     * MakeV constructor.
29
     */
30
    public function __construct()
31
    {
32
        parent::__construct();
33
    }
34
35
    /**
36
     * Execute the console command.
37
     */
38
    public function handle()
39
    {
40
        $this->info('Running command ' . $command = $this->command());
41
        passthru($command);
42
    }
43
44
    /**
45
     * Obtain command.
46
     *
47
     * @return string
48
     */
49
    protected function command()
50
    {
51
        $api = $this->option('api') ? ' --api '  : '';
52
        $action = $this->argument('action') ? ' ' . $this->argument('action') . ' ' : '';
53
        return 'php artisan make:route ' . $this->argument('link') . $action . ' --type=' . $this->option('type') .
54
            ' --method=' . $this->option('method') .
55
            $api .
56
            ' -a --menu';
57
    }
58
}
59