GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

PanelCommand::handle()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 36

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 36
rs 9.344
c 0
b 0
f 0
cc 2
nc 2
nop 0
1
<?php namespace Serverfireteam\Panel\Commands;
2
3
use Illuminate\Console\Command;
4
use Symfony\Component\Console\Input\InputOption;
5
use Symfony\Component\Console\Input\InputArgument;
6
use Illuminate\Support\Facades\File;
7
8
class PanelCommand extends Command {
9
10
	/**
11
	 * The console command name.
12
	 *
13
	 * @var string holds the name of the command
14
	 */
15
	protected $name = 'panel:install';
16
17
	/**
18
	 * The console command description.
19
	 *
20
	 * @var string holds the description of the command
21
	 */
22
	protected $description = 'Installs  Panel  migrations, configs, views and assets.';
23
24
	/**
25
	 * Create a new command instance.
26
	 *
27
	 */
28
	public function __construct()
29
	{
30
		parent::__construct();
31
	}
32
33
	/**
34
	 * Execute the console command.
35
	 *
36
	 */
37
	public function handle()
38
	{
39
        $this->info('        [ Welcome to ServerFireTeam Panel Installation ]       ');
40
41
        $this->info('** publishing elfinder assets');
42
        $this->call('elfinder:publish');
43
44
        $this->info('** publishing panel assets');
45
        $this->call('vendor:publish', [
46
            '--tag' => 'panelpublic',
47
            '--quiet' => null
48
            //'--force' => 1
49
        ]);
50
        $this->info('** publishing panel config');
51
        $this->call('vendor:publish', [
52
            '--tag' => 'panelconfig',
53
            '--quiet' => null
54
            //'--force' => 1
55
        ]);
56
        $this->info('** publishing panel views');
57
        $this->call('vendor:publish', [
58
            '--tag' => 'panelviews',
59
            '--quiet' => null
60
            //'--force' => 1
61
        ]);
62
63
        $this->call('migrate', array('--path' => 'vendor/serverfireteam/panel/src/database/migrations'));
64
65
        $this->call('db:seed', array('--class' => '\Serverfireteam\Panel\LinkSeeder'));
66
67
        //will use for elfinder package
68
        $path = public_path().'/files/';
69
        if(!File::isDirectory($path)){
70
            File::makeDirectory($path, 0775, true, true);
71
        }
72
	}
73
74
	/**
75
	 * Get the console command arguments.
76
	 *
77
	 * @return array
78
	 */
79
	protected function getArguments()
80
	{
81
		return [];
82
	}
83
84
	/**
85
	 * Get the console command options.
86
	 *
87
	 * @return array
88
	 */
89
	protected function getOptions()
90
	{
91
		return [];
92
	}
93
94
    /**
95
     * Copy specific directories to destination
96
     * @param $destination
97
     * @return bool
98
     * @throws \ReflectionException
99
     */
100
    protected function copyFiles($destination)
101
    {
102
        $result = true;
103
        $directories = array('public');
104
        $root_path = $this->getRootPath();
105
        foreach($directories as $dir){
106
            $path = $root_path.'/'.$dir;
107
            $success = $this->files->copyDirectory($path, $destination);
108
            $result = $success && $result;
109
        }
110
        return $result;
111
    }
112
113
    /**
114
     * Find the root path from the vendor dir.
115
     * @return bool|string
116
     * @throws \ReflectionException
117
     */
118
    protected function getRootPath()
119
    {
120
        $reflector = new \ReflectionClass('serverfireteam_panel');
121
        $path = realpath(dirname($reflector->getFileName()) . '/..');
122
        return $path;
123
    }
124
125
}
126