Permissions::handle()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.8666
c 0
b 0
f 0
cc 2
nc 2
nop 0
1
<?php
2
3
namespace App\Console\Commands;
4
5
use Illuminate\Console\Command;
6
use Illuminate\Filesystem\Filesystem;
7
8
class Permissions extends Command
9
{
10
    /**
11
     * The name and signature of the console command.
12
     *
13
     * @var string
14
     */
15
    protected $signature = 'satis:permissions';
16
17
    /**
18
     * The console command description.
19
     *
20
     * @var string
21
     */
22
    protected $description = 'Sets permissions required for running UI and builder.';
23
24
    /** @var Filesystem $filesystem */
25
    protected $filesystem;
26
27
    /**
28
     * Create a new command instance.
29
     *
30
     * @param \Illuminate\Filesystem\Filesystem $filesystem
31
     */
32
    public function __construct(Filesystem $filesystem) {
33
        parent::__construct();
34
35
        $this->filesystem = $filesystem;
36
    }
37
38
    /**
39
     * Execute the console command.
40
     *
41
     * @return void
42
     */
43
    public function handle() {
44
        $this->info('Settings permissions for satis config file.');
45
46
        $configFile = config('satis.config');
47
48
        if($this->filesystem->exists($configFile)) {
49
            chmod($configFile, 777);
50
        } else {
51
            $this->error("\n" . 'Satis config file "' . $configFile . '" does not exist.
52
                Did you forget to create it?');
53
        }
54
    }
55
}
56