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.

CheckCommand::handle()   B
last analyzed

Complexity

Conditions 5
Paths 6

Size

Total Lines 27
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 16
CRAP Score 5

Importance

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