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   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 85.71%

Importance

Changes 4
Bugs 0 Features 1
Metric Value
wmc 5
c 4
b 0
f 1
lcom 1
cbo 3
dl 0
loc 64
ccs 18
cts 21
cp 0.8571
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getLongVersion() 0 4 1
A getDefaultInputDefinition() 0 13 1
A getReplacedVersion() 0 9 2
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