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 ( 170597...e2937c )
by Julien
04:03
created

DiffCommand::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 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\Reader\ReaderInterface;
12
use Jtant\LaravelEnvSync\SyncService;
13
14
class DiffCommand extends Command
15
{
16
    /**
17
     * The name and signature of the console command.
18
     *
19
     * @var string
20
     */
21
    protected $signature = 'env:diff';
22
23
    /**
24
     * The console command description.
25
     *
26
     * @var string
27
     */
28
    protected $description = 'Show the difference between env files';
29
30
    /**
31
     * @var ReaderInterface
32
     */
33
    private $reader;
34
35
36
    /**
37
     * Create a new command instance.
38
     *
39
     * @param ReaderInterface $reader
40
     */
41
    public function __construct(ReaderInterface $reader)
42
    {
43
        parent::__construct();
44
        $this->reader = $reader;
45
    }
46
47
    /**
48
     * Execute the console command.
49
     *
50
     * @return mixed
51
     */
52
    public function handle()
53
    {
54
        $env = base_path('.env');
55
        $example = base_path('.env.example');
56
57
        $envValues = $this->reader->read($env);
58
        $exampleValues = $this->reader->read($example);
59
60
        $keys = array_unique(array_merge(array_keys($envValues), array_keys($exampleValues)));
61
        sort($keys);
62
63
        $header = ["Key", basename($env), basename($example)];
64
        $lines = [];
65
        foreach ($keys as $key) {
66
            $envVal = isset($envValues[$key]) ? $envValues[$key] : '<error>NOT FOUND</error>';
67
            $exampleVal = isset($exampleValues[$key]) ? $exampleValues[$key] : '<error>NOT FOUND</error>';
68
            $lines[] = [$key, $envVal, $exampleVal];
69
        }
70
71
        $this->table($header, $lines);
72
    }
73
}
74