InstallCommand::handle()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 33
Code Lines 20

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
cc 2
eloc 20
c 2
b 1
f 0
nc 2
nop 0
dl 0
loc 33
rs 9.6
1
<?php
2
3
namespace Uccello\Core\Console\Commands;
4
5
use Illuminate\Console\Command;
6
use Illuminate\Support\Facades\Artisan;
7
8
class InstallCommand extends Command
9
{
10
    /**
11
     * The name and signature of the console command.
12
     *
13
     * @var string
14
     */
15
    protected $signature = 'uccello:install';
16
17
    /**
18
     * The console command description.
19
     *
20
     * @var string
21
     */
22
    protected $description = 'Install Uccello';
23
24
    /**
25
     * The views that need to be exported.
26
     *
27
     * @var array
28
     */
29
    protected $views = [
30
        'auth/login.stub' => 'auth/login.blade.php',
31
        'auth/register.stub' => 'auth/register.blade.php',
32
        'auth/passwords/email.stub' => 'auth/passwords/email.blade.php',
33
        'auth/passwords/reset.stub' => 'auth/passwords/reset.blade.php',
34
        'layouts/uccello.stub' => 'layouts/uccello.blade.php',
35
    ];
36
37
    /**
38
     * Create a new command instance.
39
     *
40
     * @return void
41
     */
42
    public function __construct()
43
    {
44
        parent::__construct();
45
    }
46
47
    /**
48
     * Execute the console command.
49
     *
50
     * @return mixed
51
     */
52
    public function handle()
53
    {
54
        $this->comment('Executing make:auth...');
55
        $this->callSilent('make:auth', ['--force' => true]);
56
57
        $this->comment('Publishing Uccello Assets...');
58
        $this->callSilent('vendor:publish', ['--tag' => 'uccello-assets']);
59
60
        $this->comment('Publishing Uccello Configuration...');
61
        $this->callSilent('vendor:publish', ['--tag' => 'uccello-config']);
62
63
64
        $this->comment('Copying User Model...');
65
        copy(
66
            __DIR__.'/stubs/make/app/User.stub',
67
            app_path('User.php')
68
        );
69
70
        $this->comment('Copying Login Controller...');
71
        copy(
72
            __DIR__.'/stubs/make/app/Http/Controllers/Auth/LoginController.stub',
73
            app_path('Http/Controllers/Auth/LoginController.php')
74
        );
75
76
        $this->comment('Copying Views...');
77
        foreach ($this->views as $key => $value) {
78
            copy(
79
                __DIR__.'/stubs/make/views/'.$key,
80
                resource_path('views/'.$value)
81
            );
82
        }
83
84
        $this->info(trans('Uccello scaffolding installed successfully'));
0 ignored issues
show
Bug introduced by
It seems like trans('Uccello scaffoldi...nstalled successfully') can also be of type array; however, parameter $string of Illuminate\Console\Command::info() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

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

84
        $this->info(/** @scrutinizer ignore-type */ trans('Uccello scaffolding installed successfully'));
Loading history...
85
    }
86
}