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.

Application::getReplacedVersion()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2.032

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 9
ccs 4
cts 5
cp 0.8
rs 9.6666
cc 2
eloc 5
nc 2
nop 0
crap 2.032
1
<?php
2
3
/*
4
 * This file is part of the slack-cli package.
5
 *
6
 * (c) Cas Leentfaar <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace CL\SlackCli\Console;
13
14
use Symfony\Component\Console\Application as BaseApplication;
15
use Symfony\Component\Console\Input\InputOption;
16
17
/**
18
 * @author Cas Leentfaar <[email protected]>
19
 */
20
class Application extends BaseApplication
21
{
22
    /**
23
     * @var array
24
     */
25
    private $availableEnvironments = [
26
        'prod',
27
        'test-success', // mocks a successful response
28
        'test-failure', // mocks a failed response
29
    ];
30
31
    /**
32
     * @var string
33
     */
34
    private $defaultEnvironment = 'prod';
35
36
    /**
37
     * Constructor.
38
     */
39 24
    public function __construct()
40
    {
41 24
        error_reporting(-1);
42
43 24
        parent::__construct('Slack CLI', $this->getReplacedVersion());
44 24
    }
45
46
    /**
47
     * {@inheritdoc}
48
     */
49
    public function getLongVersion()
50
    {
51
        return sprintf('%s by <comment>Cas Leentfaar</comment>', parent::getLongVersion());
52
    }
53
54
    /**
55
     * {@inheritdoc}
56
     */
57 24
    protected function getDefaultInputDefinition()
58
    {
59 24
        $parentDefinition = parent::getDefaultInputDefinition();
60 24
        $parentDefinition->addOption(new InputOption(
61 24
            '--env',
62 24
            'e',
63 24
            InputOption::VALUE_REQUIRED,
64 24
            sprintf('The environment to run the Slack CLI under (%s)', implode('|', $this->availableEnvironments)),
65 24
            $this->defaultEnvironment
66 24
        ));
67
68 24
        return $parentDefinition;
69
    }
70
71
    /**
72
     * @return null|string
73
     */
74 24
    private function getReplacedVersion()
75
    {
76 24
        $version = '@git-version@';
77 24
        if ($version === '@' . 'git-version@') {
78 24
            return 'UNKNOWN';
79
        }
80
81
        return $version;
82
    }
83
}
84