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.

Code Duplication    Length = 38-38 lines in 2 locations

src/Strime/Slackify/Api/Api.php 1 location

@@ 27-64 (lines=38) @@
24
     * @param  string $foo
25
     * @return Api
26
     */
27
    public function test($error = NULL, $foo = NULL) {
28
29
        // Check if the type of the variables is valid.
30
        if (($error != NULL) && !is_string($error)) {
31
            throw new InvalidArgumentException("The type of the error variable is not valid.");
32
        }
33
        if (($foo != NULL) && !is_string($foo)) {
34
            throw new InvalidArgumentException("The type of the foo variable is not valid.");
35
        }
36
37
        // Set the arguments of the request
38
        $arguments = array();
39
40
        if($error != NULL) {
41
            $arguments["error"] = $error;
42
        }
43
        if($foo != NULL) {
44
            $arguments["foo"] = $foo;
45
        }
46
47
        $this->setUrl("api.test", $arguments);
48
49
        // Send the request
50
        try {
51
            $client = new \GuzzleHttp\Client();
52
            $json_response = $client->request('GET', $this->getUrl(), []);
53
            $response = json_decode( $json_response->getBody() );
54
        }
55
        catch (RequestException $e) {
56
            throw new RuntimeException('The request to the API failed: '.$e->getMessage(), $e->getCode(), $e);
57
        }
58
59
        if($response->{'ok'} === FALSE) {
60
            throw new RuntimeException('The request to the API failed: '.$response->{'error'}.".");
61
        }
62
63
        return $this;
64
    }
65
}
66

src/Strime/Slackify/Api/UsersProfile.php 1 location

@@ 27-64 (lines=38) @@
24
     * @param  bool $include_labels
25
     * @return string
26
     */
27
    public function get($user = NULL, $include_labels = NULL) {
28
29
        // Check if the type of the variables is valid.
30
        if (!is_string($user) && ($user != NULL)) {
31
            throw new InvalidArgumentException("The type of the user variable is not valid.");
32
        }
33
        if (!is_string($include_labels) && ($include_labels != NULL)) {
34
            throw new InvalidArgumentException("The type of the include_labels variable is not valid.");
35
        }
36
37
        // Set the arguments of the request
38
        $arguments = array();
39
40
        if ($user != NULL) {
41
            $arguments["user"] = $user;
42
        }
43
        if ($include_labels != NULL) {
44
            $arguments["include_labels"] = $include_labels;
45
        }
46
47
        $this->setUrl("users.profile.get", $arguments);
48
49
        // Send the request
50
        try {
51
            $client = new \GuzzleHttp\Client();
52
            $json_response = $client->request('GET', $this->getUrl(), []);
53
            $response = json_decode( $json_response->getBody() );
54
        }
55
        catch (RequestException $e) {
56
            throw new RuntimeException('The request to the API failed: '.$e->getMessage(), $e->getCode(), $e);
57
        }
58
59
        if($response->{'ok'} === FALSE) {
60
            throw new RuntimeException('The request to the API failed: '.$response->{'error'}.".");
61
        }
62
63
        return $json_response->getBody();
64
    }
65
66
67