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 ( 0b1791...170597 )
by Julien
04:32
created

CheckCommand::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
crap 1
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 3
    public function __construct(SyncService $sync)
41
    {
42 3
        parent::__construct();
43 3
        $this->sync = $sync;
44 3
    }
45
46
    /**
47
     * Execute the console command.
48
     *
49
     * @return mixed
50
     */
51 2
    public function handle()
52
    {
53 2
        $first = base_path('.env.example');
54 2
        $second = base_path('.env');
55
56 2
        if ($this->option('reverse')) {
57
            $switch = $first;
58
            $first = $second;
59
            $second = $switch;
60
            unset($switch);
61
        }
62
63 2
        $diffs = $this->sync->getDiff($first, $second);
64
65 2
        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 1
        $this->info(sprintf("The following variables are not present in your %s file : ", basename($second)));
71 1
        foreach ($diffs as $key => $diff) {
72 1
            $this->info(sprintf("\t- %s = %s", $key, $diff));
73
        }
74
75 1
        $this->info(sprintf("You can use `php artisan env:sync%s` to synchronise them", $this->option('reverse') ? ' --reverse' : ''));
76
77 1
        return 1;
78
    }
79
}
80