VueWorkflowCommand::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php namespace Bantenprov\VueWorkflow\Console\Commands;
2
3
use Illuminate\Console\Command;
4
use File;
5
/**
6
 * The VueWorkflowCommand class.
7
 *
8
 * @package Bantenprov\VueWorkflow
9
 * @author  bantenprov <[email protected]>
10
 */
11
class VueWorkflowCommand extends Command
12
{
13
14
    /**
15
     * The name and signature of the console command.
16
     *
17
     * @var string
18
     */
19
    protected $signature = 'vue-workflow:publish-trait';
20
21
    /**
22
     * The console command description.
23
     *
24
     * @var string
25
     */
26
    protected $description = 'Publish Trait for Bantenprov\VueWorkflow package';
27
28
    /**
29
     * Create a new command instance.
30
     *
31
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
32
     */
33
    public function __construct()
34
    {
35
        parent::__construct();
36
    }
37
38
    /**
39
     * Execute the console command.
40
     *
41
     * @return mixed
42
     */
43
    public function handle()
44
    {        
45
        if(!File::exists(base_path().'/app/Http/Controllers/Traits')){
46
            File::makeDirectory(base_path().'/app/Http/Controllers/Traits');
47 View Code Duplication
            if(!File::exists(base_path().'/app/Http/Controllers/Traits/WorkflowConditionTrait.php')){
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across 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...
48
                File::put(base_path().'/app/Http/Controllers/Traits/WorkflowConditionTrait.php',File::get(__DIR__.'/../../stubs/WorkflowConditionTrait.stub'));
49
50
                $this->info('Publishing complete');
51
            }else{
52
                $this->error('File WorkflowConditionTrait.php already exist');
53
            }
54 View Code Duplication
        }else{
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across 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...
55
            if(!File::exists(base_path().'/app/Http/Controllers/Traits/WorkflowConditionTrait.php')){
56
                File::put(base_path().'/app/Http/Controllers/Traits/WorkflowConditionTrait.php',File::get(__DIR__.'/../../stubs/WorkflowConditionTrait.stub'));
57
                
58
                $this->info('Publishing complete');
59
            }else{
60
                $this->error('File WorkflowConditionTrait.php already exist');
61
            }
62
        }
63
    }
64
}
65