Passed
Push — dev6 ( 12f075...228a03 )
by Ron
07:47
created

ActivateModuleCommand   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 11
c 1
b 0
f 0
dl 0
loc 28
ccs 0
cts 8
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 19 2
1
<?php
2
3
namespace App\Console\Commands;
4
5
use Illuminate\Console\Command;
6
7
class ActivateModuleCommand extends Command
8
{
9
    protected $signature   = 'tb_module:activate {module}';
10
    protected $description = 'Activate a new Tech Bench Add On Module for use';
11
12
13
    /**
14
     *  Activate the new Module
15
     */
16
    public function handle()
17
    {
18
        //  Name of the Module Folder
19
        $module = $this->argument('module');
20
21
        $this->line('Activating Module '.$module);
0 ignored issues
show
Bug introduced by
Are you sure $module of type null|string|string[] can be used in concatenation? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

21
        $this->line('Activating Module './** @scrutinizer ignore-type */ $module);
Loading history...
22
23
        if(file_exists(base_path().'/Modules/'.$module.'/Config/config.php'))
24
        {
25
            //  Create a symbolic link to the module
26
            $this->laravel->make('files')->link(base_path().'/Modules/'.$module.'/resources/js', base_path().'/resources/js/Modules/'.$module);
27
            $this->info('The Module '.$module.' has been successfully activated');
28
        }
29
        else
30
        {
31
            $this->error('Unable to find the '.$module.' Module.  Please verify it is loaded in the correct folder');
32
        }
33
34
        return 0;
35
    }
36
}
37