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.

ChannelsInfoCommand::configure()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 1

Importance

Changes 3
Bugs 0 Features 0
Metric Value
c 3
b 0
f 0
dl 0
loc 15
ccs 8
cts 8
cp 1
rs 9.4285
cc 1
eloc 8
nc 1
nop 0
crap 1
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\ChannelsInfoPayload;
15
use CL\Slack\Payload\ChannelsInfoPayloadResponse;
16
use Symfony\Component\Console\Input\InputArgument;
17
18
/**
19
 * @author Cas Leentfaar <[email protected]>
20
 */
21
class ChannelsInfoCommand extends AbstractApiCommand
22
{
23
    /**
24
     * {@inheritDoc}
25
     */
26 1
    protected function configure()
27
    {
28 1
        parent::configure();
29
30 1
        $this->setName('channels:info');
31 1
        $this->setDescription('Returns information about a team channel.');
32 1
        $this->addArgument('channel-id', InputArgument::REQUIRED, 'The ID of the channel to get information on');
33 1
        $this->setHelp(<<<EOT
34
The <info>channels:info</info> command returns information about a given channel.
35
36
For more information about the related API method, check out the official documentation:
37
<comment>https://api.slack.com/methods/channels.info</comment>
38
EOT
39 1
        );
40 1
    }
41
42
    /**
43
     * @return ChannelsInfoPayload
44
     */
45 1
    protected function createPayload()
46
    {
47 1
        $payload = new ChannelsInfoPayload();
48 1
        $payload->setChannelId($this->input->getArgument('channel-id'));
49
50 1
        return $payload;
51
    }
52
53
    /**
54
     * {@inheritdoc}
55
     *
56
     * @param ChannelsInfoPayloadResponse $payloadResponse
57
     */
58 1
    protected function handleResponse($payloadResponse)
59
    {
60 1
        if ($payloadResponse->isOk()) {
61 1
            $data = $this->serializeObjectToArray($payloadResponse->getChannel());
62 1
            $this->renderKeyValueTable($data);
63 1
            $this->writeOk('Successfully retrieved information about the channel!');
64 1
        } else {
65 1
            $this->writeError(sprintf('Failed to retrieve information about the channel: %s', lcfirst($payloadResponse->getErrorExplanation())));
66
        }
67 1
    }
68
}
69