Permissions   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 48
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A handle() 0 12 2
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