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 ( f579cb...82d2f6 )
by Freek
01:57
created

WatcherCommand::configure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
namespace Spatie\PhpUnitWatcher;
4
5
use Symfony\Component\Console\Command\Command;
6
use Symfony\Component\Console\Input\InputArgument;
7
use Symfony\Component\Console\Input\InputInterface;
8
use Symfony\Component\Console\Output\OutputInterface;
9
use Symfony\Component\Console\Style\SymfonyStyle;
10
use Symfony\Component\Yaml\Yaml;
11
12
class WatcherCommand extends Command
13
{
14
    protected function configure()
15
    {
16
        $this->setName('watch')
17
            ->setDescription('Rerun PHPUnit tests when source code changes.')
18
            ->addArgument('phpunit-options', InputArgument::OPTIONAL, 'Options passed to phpunit');
19
    }
20
21
    protected function execute(InputInterface $input, OutputInterface $output)
22
    {
23
        $options = $this->determineOptions($input);
24
25
        list($watcher, $options) = WatcherFactory::create($options);
26
27
        $this->displayOptions($options, $input, $output);
28
29
        $watcher->startWatching();
30
    }
31
32
    protected function determineOptions(InputInterface $input): array
33
    {
34
        $options = $this->getOptionsFromConfigFile();
35
36
        $options['phpunitArguments'] = trim($input->getArgument('phpunit-options'), "'");
37
38
        return $options;
39
    }
40
41
    protected function getOptionsFromConfigFile(): array
42
    {
43
        $configFile = getcwd() . '/.phpunit-watcher.yml';
44
45
        if (! file_exists($configFile)) {
46
            return [];
47
        }
48
49
        return Yaml::parse(file_get_contents($configFile));
50
    }
51
52
    protected function displayOptions(array $options, InputInterface $input, OutputInterface $output)
53
    {
54
        $output = new SymfonyStyle($input, $output);
55
56
        $output->title("Starting PHPUnit Watcher");
57
58
        $output->text("Tests will be rerun when {$options['watch']['fileMask']} files are modified in");
59
60
        $output->listing($options['watch']['directories']);
61
62
        $output->newLine();
63
    }
64
}
65