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.

InitCommand::execute()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 16
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 8
nc 2
nop 2
dl 0
loc 16
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Inspector\Application\Commands;
4
5
use Inspector\Application;
6
use Inspector\Application\Command;
7
use Illuminate\Filesystem\Filesystem;
8
use Symfony\Component\Console\Input\InputInterface;
9
use Symfony\Component\Console\Output\OutputInterface;
10
11
class InitCommand extends Command
12
{
13
14
    protected $name = 'init';
15
16
    protected $description = 'Initializes & generates an config file';
17
18
    /**
19
     * @param InputInterface $input
20
     * @param OutputInterface $output
21
     * @return int|null|void
22
     * @throws \Exception
23
     */
24
    protected function execute(InputInterface $input, OutputInterface $output)
25
    {
26
        /** @var FileSystem $fileSystem */
27
        $fileSystem = $this->getContainer()->make('filesystem');
28
29
        $sourceFile = __DIR__ . '/../../../' . Application::APP_DEFAULT_CONFIG . '.dist';
30
        $destinationFile = getcwd() . '/' . Application::APP_DEFAULT_CONFIG;
31
32
        if ($fileSystem->exists($destinationFile)) {
33
            throw new \Exception('Config file has already been initialized.');
34
        }
35
36
        $fileSystem->copy($sourceFile, $destinationFile);
37
38
        $output->writeln('<comment>Config file generated at:</comment> ' . $destinationFile);
39
    }
40
}
41