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.

ConfigEditCommand   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 2

Test Coverage

Coverage 59.26%

Importance

Changes 4
Bugs 1 Features 0
Metric Value
wmc 8
c 4
b 1
f 0
lcom 2
cbo 2
dl 0
loc 54
ccs 16
cts 27
cp 0.5926
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 18 1
C execute() 0 26 7
1
<?php
2
3
namespace CL\SlackCli\Command;
4
5
use CL\SlackCli\Config\Config;
6
use Symfony\Component\Console\Input\InputInterface;
7
use Symfony\Component\Console\Output\OutputInterface;
8
9
/**
10
 * @author Cas Leentfaar <[email protected]>
11
 */
12
class ConfigEditCommand extends AbstractCommand
13
{
14
    /**
15
     * {@inheritDoc}
16
     */
17 1
    protected function configure()
18
    {
19 1
        parent::configure();
20
21 1
        $this->setName('config:edit');
22 1
        $this->setDescription('Edit config options');
23
24 1
        $this->setHelp(<<<EOT
25
The <info>config:edit</info> command allows you to edit the Slack CLI settings using a pre-configured editor.
26
27
To choose your editor you can set the "SLACK_CONFIG_EDITOR" environment variable.
28
29
To get a list of configuration values in the file, use the `config:list` command:
30
31
    <comment>slack.phar config:list</comment>
32
EOT
33 1
        );
34 1
    }
35
36
    /**
37
     * {@inheritDoc}
38
     */
39 1
    protected function execute(InputInterface $input, OutputInterface $output)
40
    {
41 1
        $editor = escapeshellcmd(getenv('SLACK_CONFIG_EDITOR'));
42 1
        if (!$editor) {
43
            if (defined('PHP_WINDOWS_VERSION_BUILD')) {
44
                $editor = 'notepad';
45
            } else {
46
                foreach (['vim', 'vi', 'nano', 'pico', 'ed'] as $candidate) {
47
                    if (exec('which ' . $candidate)) {
48
                        $editor = $candidate;
49
                        break;
50
                    }
51
                }
52
            }
53
        }
54
55 1
        $file    = $this->getConfigPath();
56 1
        $to      = defined('PHP_WINDOWS_VERSION_BUILD') ? '' : ' > `tty`';
57 1
        $command = sprintf('%s %s%s', $editor, $file, $to);
58
59 1
        $this->output->writeln(sprintf('Editing `%s` using `%s`...', $file, $editor));
60
61 1
        if (!$this->isTest()) {
62
            system($command);
63
        }
64 1
    }
65
}
66