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.

ApiTestPayload::getArgument()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2.0625

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 3
cts 4
cp 0.75
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 2.0625
1
<?php
2
3
/*
4
 * This file is part of the Slack API library.
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\Slack\Payload;
13
14
/**
15
 * Payload that triggers the api.test-method; allowing you to test a connection with the Slack API.
16
 *
17
 * @author Cas Leentfaar <[email protected]>
18
 *
19
 * @see    Official documentation at https://api.slack.com/methods/api.test
20
 */
21
class ApiTestPayload extends AbstractPayload
22
{
23
    /**
24
     * @var array
25
     */
26
    private $args = [];
27
28
    /**
29
     * @var string
30
     */
31
    private $error;
32
33
    /**
34
     * @param array $args
35
     */
36
    public function replaceArguments(array $args)
37
    {
38
        $this->args = $args;
39
    }
40
41
    /**
42
     * @param string $key
43
     * @param mixed  $value
44
     */
45 1
    public function addArgument($key, $value)
46
    {
47 1
        $this->args[$key] = $value;
48 1
    }
49
50
    /**
51
     * @param string $key
52
     *
53
     * @return mixed
54
     */
55 1
    public function getArgument($key)
56
    {
57 1
        if (!array_key_exists($key, $this->args)) {
58
            throw new \InvalidArgumentException(sprintf('There is no argument with that name: "%s"', $key));
59
        }
60
61 1
        return $this->args[$key];
62
    }
63
64
    /**
65
     * @return array
66
     */
67
    public function getArguments()
68
    {
69
        return $this->args;
70
    }
71
72
    /**
73
     * @param string|null $error Error response to return
74
     */
75 1
    public function setError($error)
76
    {
77 1
        $this->error = $error;
78 1
    }
79
80
    /**
81
     * @return string|null Error response to return
82
     */
83 1
    public function getError()
84
    {
85 1
        return $this->error;
86
    }
87
88
    /**
89
     * @inheritdoc
90
     */
91 1
    public function getMethod()
92
    {
93 1
        return 'api.test';
94
    }
95
}
96