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.
Completed
Push — master ( e2937c...75a65c )
by Julien
03:48
created

CheckCommand::handle()   B

Complexity

Conditions 5
Paths 6

Size

Total Lines 28
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 17
CRAP Score 5

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 28
ccs 17
cts 17
cp 1
rs 8.439
cc 5
eloc 17
nc 6
nop 0
crap 5
1
<?php
2
/**
3
 * Laravel-Env-Sync
4
 *
5
 * @author Julien Tant - Craftyx <[email protected]>
6
 */
7
8
namespace Jtant\LaravelEnvSync\Console;
9
10
use Illuminate\Console\Command;
11
use Jtant\LaravelEnvSync\SyncService;
12
13
class CheckCommand extends Command
14
{
15
    /**
16
     * The name and signature of the console command.
17
     *
18
     * @var string
19
     */
20
    protected $signature = 'env:check {--reverse}';
21
22
    /**
23
     * The console command description.
24
     *
25
     * @var string
26
     */
27
    protected $description = 'Check if your envs files are in sync';
28
29
    /**
30
     * @var SyncService
31
     */
32
    private $sync;
33
34
35
    /**
36
     * Create a new command instance.
37
     *
38
     * @param SyncService $sync
39
     */
40 6
    public function __construct(SyncService $sync)
41
    {
42 6
        parent::__construct();
43 6
        $this->sync = $sync;
44 6
    }
45
46
    /**
47
     * Execute the console command.
48
     *
49
     * @return mixed
50
     */
51 3
    public function handle()
52
    {
53 3
        $first = base_path('.env.example');
54 3
        $second = base_path('.env');
55
56 3
        if ($this->option('reverse')) {
57 1
            $switch = $first;
58 1
            $first = $second;
59 1
            $second = $switch;
60 1
            unset($switch);
61
        }
62
63 3
        $diffs = $this->sync->getDiff($first, $second);
64
65 3
        if (count($diffs) === 0) {
66 1
            $this->info(sprintf("Your %s file is already in sync with %s", basename($second), basename($first)));
67 1
            return 0;
68
        }
69
70 2
        $this->info(sprintf("The following variables are not present in your %s file : ", basename($second)));
71 2
        foreach ($diffs as $key => $diff) {
72 2
            $this->info(sprintf("\t- %s = %s", $key, $diff));
73
        }
74
75 2
        $this->info(sprintf("You can use `php artisan env:sync%s` to synchronise them", $this->option('reverse') ? ' --reverse' : ''));
76
77 2
        return 1;
78
    }
79
}
80