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.

UsersInfoCommand::handleResponse()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

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