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.

ImListCommand   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 3
Dependencies 4

Importance

Changes 5
Bugs 1 Features 0
Metric Value
wmc 5
c 5
b 1
f 0
lcom 3
cbo 4
dl 0
loc 51
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 14 1
A createPayload() 0 7 1
A handleResponse() 0 14 3
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\Command;
13
14
use CL\Slack\Payload\ImListPayload;
15
use CL\Slack\Payload\ImListPayloadResponse;
16
use Symfony\Component\Console\Input\InputOption;
17
18
/**
19
 * @author Cas Leentfaar <[email protected]>
20
 */
21
class ImListCommand extends AbstractApiCommand
22
{
23
    /**
24
     * {@inheritDoc}
25
     */
26
    protected function configure()
27
    {
28
        parent::configure();
29
30
        $this->setName('im:list');
31
        $this->setDescription('Returns a list of all IM channels in your Slack team');
32
        $this->addOption('exclude-archived', null, InputOption::VALUE_OPTIONAL, 'Don\'t return archived IM channels.');
33
        $this->setHelp(<<<EOT
34
The <info>im:list</info> command returns a list of all IM channels in your Slack team.
35
This includes channels the caller is in, channels they are not currently in, and archived channels.
36
The number of (non-deactivated) members in each channel is also returned.
37
EOT
38
        );
39
    }
40
41
    /**
42
     * @return ImListPayload
43
     */
44
    protected function createPayload()
45
    {
46
        $payload = new ImListPayload();
47
        $payload->setExcludeArchived($this->input->getOption('exclude-archived'));
48
49
        return $payload;
50
    }
51
52
    /**
53
     * {@inheritdoc}
54
     *
55
     * @param ImListPayloadResponse $payloadResponse
56
     */
57
    protected function handleResponse($payloadResponse)
58
    {
59
        if ($payloadResponse->isOk()) {
60
            $channels = $payloadResponse->getImChannels();
61
            if (!empty($channels)) {
62
                $this->renderTable($channels, null);
63
                $this->writeOk('Finished listing channels');
64
            } else {
65
                $this->writeComment('No IM channels to list');
66
            }
67
        } else {
68
            $this->writeError(sprintf('Failed to list channels. %s', lcfirst($payloadResponse->getErrorExplanation())));
69
        }
70
    }
71
}
72