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.

Export::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 0
cts 4
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
crap 2
1
<?php
2
3
namespace Talal\Exporter\Console\Command;
4
5
use Illuminate\Console\Command;
6
use Illuminate\Filesystem\Filesystem;
7
use Talal\Exporter\Exporter;
8
9
class Export extends Command
10
{
11
    /**
12
     * The name and signature of the console command.
13
     *
14
     * @var string
15
     */
16
    protected $signature = 'env:export {server : A supported web server} 
17
                                       {--file=.env : The environment file}';
18
19
    /**
20
     * The console command description.
21
     *
22
     * @var string
23
     */
24
    protected $description = 'Export the environment file to a capable web server format.';
25
26
    /**
27
     * @var \Illuminate\Filesystem\Filesystem
28
     */
29
    protected $filesystem;
30
31
    /**
32
     * Create a new export command instance.
33
     *
34
     * @param \Illuminate\Filesystem\Filesystem $filesystem
35
     */
36
    public function __construct(Filesystem $filesystem)
37
    {
38
        $this->filesystem = $filesystem;
39
40
        parent::__construct();
41
    }
42
43
    /**
44
     * Execute the console command.
45
     */
46
    public function handle()
47
    {
48
        $fileContents = $this->filesystem->get(
49
            $this->laravel->basePath() . '/' . $this->option('file')
50
        );
51
52
        $this->export($fileContents);
53
    }
54
55
    /**
56
     * Export the environment file.
57
     *
58
     * @param $fileContents
59
     * @return int
60
     */
61
    protected function export($fileContents)
62
    {
63
        $server = strtolower($this->argument('server'));
64
        $server = sprintf('Talal\Exporter\Output\%s', ucfirst($server));
65
66
        if (! class_exists($server)) {
67
            $this->error('The provided server is not exportable.');
68
            return 0;
69
        }
70
71
        $exporter = new Exporter(new $server($fileContents));
72
        $this->line($exporter->output());
73
    }
74
}
75