CreateControllerCommand::controllerViewCreate()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 3

Duplication

Lines 9
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
c 1
b 0
f 0
nc 2
nop 0
dl 9
loc 9
rs 9.6666
1
<?php
2
3
namespace Bantenprov\YankesInfoKamar\Commands;
4
5
use Illuminate\Console\Command;
6
use Illuminate\Support\Facades\Config;
7
use Symfony\Component\Console\Input\InputOption;
8
use Symfony\Component\Console\Input\InputArgument;
9
use File;
10
11 View Code Duplication
class CreateControllerCommand 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...
12
{
13
    /**
14
     * The name and signature of the console command.
15
     *
16
     * @var string
17
     */
18
    protected $signature = 'bantenprov:create-controller';
19
20
    /**
21
     * The console command description.
22
     *
23
     * @var string
24
     */
25
    protected $description = 'Create controller';
26
27
    /**
28
     * Create a new command instance.
29
     *
30
     * @return void
31
     */
32
33
    protected $stubsController = [
34
        'controllers' => [
35
            'BedController.stub',
36
            'InfoKamarController.stub',
37
            'KelasController.stub',
38
            'RuangController.stub'
39
        ]
40
    ];
41
42
43
44
    public function __construct()
45
    {
46
        parent::__construct();
47
48
    }
49
50
    protected function controllerViewCreate()
51
    {
52
53
        foreach($this->stubsController['controllers'] as $stub)
54
        {
55
            File::put(base_path('app/Http/Controllers/').str_replace('stub','php',$stub),File::get(__DIR__.'/../stubs/Controllers/'.$stub));
56
        }
57
58
    }
59
60
61
    public function handle()
62
    {
63
        $this->controllerViewCreate();
64
        $this->info('Create controller success');
65
    }
66
}
67