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.

EmojiListCommand   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 4

Importance

Changes 4
Bugs 0 Features 0
Metric Value
wmc 5
c 4
b 0
f 0
lcom 2
cbo 4
dl 0
loc 53
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 19 1
A createPayload() 0 6 1
A handleResponse() 0 12 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\EmojiListPayload;
15
use CL\Slack\Payload\EmojiListPayloadResponse;
16
17
/**
18
 * @author Cas Leentfaar <[email protected]>
19
 */
20
class EmojiListCommand extends AbstractApiCommand
21
{
22
    /**
23
     * {@inheritDoc}
24
     */
25
    protected function configure()
26
    {
27
        parent::configure();
28
29
        $this->setName('emoji:list');
30
        $this->setDescription('Returns a list of all the custom emoji for your Slack team');
31
        $this->setHelp(<<<EOT
32
The <info>emoji:list</info> command returns a list of all the custom emoji in your Slack team.
33
34
The emoji property contains a map of name/url pairs, one for each custom emoji used by the team.
35
36
The alias: <comment>pseudo-protocol</comment> will be used where the emoji is an alias, the string following the colon is
37
the name of the other emoji this emoji is an alias to.
38
39
For more information about the related API method, check out the official documentation:
40
<comment>https://api.slack.com/methods/emoji.list</comment>
41
EOT
42
        );
43
    }
44
45
    /**
46
     * @return EmojiListPayload
47
     */
48
    protected function createPayload()
49
    {
50
        $payload = new EmojiListPayload();
51
52
        return $payload;
53
    }
54
55
    /**
56
     * {@inheritdoc}
57
     *
58
     * @param EmojiListPayloadResponse $payloadResponse
59
     */
60
    protected function handleResponse($payloadResponse)
61
    {
62
        if ($payloadResponse->isOk()) {
63
            $emojis = $payloadResponse->getEmojis();
64
            $this->output->writeln(sprintf('Got <comment>%d</comment> emojis...', count($emojis)));
65
            if (!empty($emojis)) {
66
                $this->renderKeyValueTable($emojis, ['Name', 'URL']);
67
            }
68
        } else {
69
            $this->writeError(sprintf('Failed to fetch emojis: %s', lcfirst($payloadResponse->getErrorExplanation())));
70
        }
71
    }
72
}
73