Passed
Push — master ( 8366d7...daf92e )
by Bruno
08:53
created

ModelariumInitCommand::handle()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 18
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
dl 0
loc 18
rs 9.9
c 1
b 0
f 0
cc 3
nc 4
nop 0
1
<?php declare(strict_types=1);
2
3
namespace Modelarium\Laravel\Console\Commands;
4
5
use Illuminate\Console\Command;
6
7
use function Safe\unlink;
8
9
class ModelariumInitCommand extends Command
10
{
11
    /**
12
     * The name and signature of the console command.
13
     *
14
     * @var string
15
     */
16
    protected $signature = 'modelarium:init';
17
18
    /**
19
     * The console command description.
20
     *
21
     * @var string
22
     */
23
    protected $description = 'Inits project for Modelarium';
24
25
    /**
26
     * Create a new command instance.
27
     *
28
     * @return void
29
     */
30
    public function __construct()
31
    {
32
        parent::__construct();
33
    }
34
35
    /**
36
     * Execute the console command.
37
     *
38
     * @return mixed
39
     */
40
    public function handle()
41
    {
42
        $this->info("Removing original User code.");
43
        $f = base_path('app/User.php');
0 ignored issues
show
Bug introduced by
The function base_path was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

43
        $f = /** @scrutinizer ignore-call */ base_path('app/User.php');
Loading history...
44
        if (file_exists($f)) {
45
            unlink($f);
46
        }
47
        $f = base_path('database/migrations/2014_10_12_000000_create_users_table.php');
48
        if (file_exists($f)) {
49
            unlink($f);
50
        }
51
52
        $this->call('vendor:publish', [
53
            '--provider' => "Modelarium\\Laravel\\ServiceProvider",
54
            '--tag' => "schema"
55
        ]);
56
57
        $this->info("Setup done.");
58
    }
59
}
60