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.

UsersSetActiveCommand   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 15 1
A createPayload() 0 6 1
A handleResponse() 0 11 2
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 setactivermation, 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\UsersSetActivePayload;
15
use CL\Slack\Payload\UsersSetActivePayloadResponse;
16
17
/**
18
 * @author Cas Leentfaar <[email protected]>
19
 */
20
class UsersSetActiveCommand extends AbstractApiCommand
21
{
22
    /**
23
     * {@inheritDoc}
24
     */
25
    protected function configure()
26
    {
27
        parent::configure();
28
29
        $this->setName('users:set-active');
30
        $this->setDescription('Lets the slack messaging server know that the token\'s user is currently active');
31
        $this->setHelp(<<<EOT
32
The <info>users:set-active</info> command lets the slack messaging server know that the token's
33
user is currently active. Consult the presence documentation for more details (see link below).
34
35
For more information about the related API method, check out the official documentation:
36
<comment>https://api.slack.com/methods/users.setActive</comment>
37
EOT
38
        );
39
    }
40
41
    /**
42
     * @return UsersSetActivePayload
43
     */
44
    protected function createPayload()
45
    {
46
        $payload = new UsersSetActivePayload();
47
48
        return $payload;
49
    }
50
51
    /**
52
     * {@inheritdoc}
53
     *
54
     * @param UsersSetActivePayloadResponse $payloadResponse
55
     */
56
    protected function handleResponse($payloadResponse)
57
    {
58
        if ($payloadResponse->isOk()) {
59
            $this->writeOk('Successfully informed Slack of the token user\'s active status');
60
        } else {
61
            $this->writeError(sprintf(
62
                'Failed to set the user to active: %s',
63
                lcfirst($payloadResponse->getErrorExplanation())
64
            ));
65
        }
66
    }
67
}
68