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.

AbstractCommand   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 43
rs 10
c 0
b 0
f 0
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A execute() 0 5 1
A init() 0 10 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Teebot\Command;
6
7
use Symfony\Component\Console\{
8
    Command\Command,
9
    Input\InputInterface,
10
    Output\OutputInterface,
11
    Exception\RuntimeException
12
};
13
use Teebot\ClientInterface;
14
use Teebot\Configuration\{
15
    ContainerInterface,
16
    Loader as ConfigLoader
17
};
18
19
class AbstractCommand extends Command
20
{
21
    /**
22
     * @var string $path Bot path
23
     */
24
    protected $path;
25
26
    /**
27
     * @var ClientInterface
28
     */
29
    protected $client;
30
31
    /**
32
     * @var ContainerInterface
33
     */
34
    protected $config;
35
36
    /**
37
     * @param string $path
38
     */
39
    protected function init(string $path)
40
    {
41
        $rPath = realpath($path);
42
43
        if (!is_dir($rPath) || !is_readable($rPath)) {
44
            throw new RuntimeException(sprintf('Bot directory with absolute path "%s" does not exist or not readable.', $path));
45
        }
46
47
        $configLoader = new ConfigLoader($rPath);
48
        $this->config = $configLoader->load();
49
    }
50
51
    /**
52
     * Executes command
53
     *
54
     * @param InputInterface  $input
55
     * @param OutputInterface $output
56
     */
57
    protected function execute(InputInterface $input, OutputInterface $output)
58
    {
59
        $path = $input->getArgument('path');
60
61
        $this->init($path);
62
    }
63
}
64