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 3 locations

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

@@ 455-492 (lines=38) @@
452
     * @param  boolean $validate
453
     * @return Channels
454
     */
455
    public function rename($channel, $name, $validate = TRUE) {
456
457
        // Check if the type of the variables is valid.
458
        if (!is_string($channel)) {
459
            throw new InvalidArgumentException("The type of the channel variable is not valid.");
460
        }
461
        if (!is_string($name)) {
462
            throw new InvalidArgumentException("The type of the name variable is not valid.");
463
        }
464
        if (!is_bool($validate)) {
465
            throw new InvalidArgumentException("The type of the validate variable is not valid.");
466
        }
467
468
        // Set the arguments of the request
469
        $arguments = array(
470
            "channel" => $channel,
471
            "name" => $name,
472
            "validate" => $validate
473
        );
474
475
        $this->setUrl("channels.rename", $arguments);
476
477
        // Send the request
478
        try {
479
            $client = new \GuzzleHttp\Client();
480
            $json_response = $client->request('GET', $this->getUrl(), []);
481
            $response = json_decode( $json_response->getBody() );
482
        }
483
        catch (RequestException $e) {
484
            throw new RuntimeException('The request to the API failed: '.$e->getMessage(), $e->getCode(), $e);
485
        }
486
487
        if($response->{'ok'} === FALSE) {
488
            throw new RuntimeException('The request to the API failed: '.$response->{'error'}.".");
489
        }
490
491
        return $json_response->getBody();
492
    }
493
494
495

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

@@ 67-104 (lines=38) @@
64
     * @param  integer $page
65
     * @return Files
66
     */
67
    public function info($file, $count = 100, $page = 1) {
68
69
        // Check if the type of the variables is valid.
70
        if (!is_string($file)) {
71
            throw new InvalidArgumentException("The type of the file variable is not valid.");
72
        }
73
        if (!is_integer($count)) {
74
            throw new InvalidArgumentException("The type of the count variable is not valid.");
75
        }
76
        if (!is_integer($page)) {
77
            throw new InvalidArgumentException("The type of the page variable is not valid.");
78
        }
79
80
        // Set the arguments of the request
81
        $arguments = array(
82
            "file" => $file,
83
            "count" => $count,
84
            "page" => $page
85
        );
86
87
        $this->setUrl("files.info", $arguments);
88
89
        // Send the request
90
        try {
91
            $client = new \GuzzleHttp\Client();
92
            $json_response = $client->request('GET', $this->getUrl(), []);
93
            $response = json_decode( $json_response->getBody() );
94
        }
95
        catch (RequestException $e) {
96
            throw new RuntimeException('The request to the API failed: '.$e->getMessage(), $e->getCode(), $e);
97
        }
98
99
        if($response->{'ok'} === FALSE) {
100
            throw new RuntimeException('The request to the API failed: '.$response->{'error'}.".");
101
        }
102
103
        return $json_response->getBody();
104
    }
105
106
107

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

@@ 122-159 (lines=38) @@
119
     * @param  string $comment
120
     * @return FilesComments
121
     */
122
    public function edit($file, $id, $comment) {
123
124
        // Check if the type of the variables is valid.
125
        if (!is_string($file)) {
126
            throw new InvalidArgumentException("The type of the file variable is not valid.");
127
        }
128
        if (!is_string($id)) {
129
            throw new InvalidArgumentException("The type of the id variable is not valid.");
130
        }
131
        if (!is_string($comment)) {
132
            throw new InvalidArgumentException("The type of the comment variable is not valid.");
133
        }
134
135
        // Set the arguments of the request
136
        $arguments = array(
137
            "file" => $file,
138
            "id" => $id,
139
            "comment" => $comment
140
        );
141
142
        $this->setUrl("files.comments.edit", $arguments);
143
144
        // Send the request
145
        try {
146
            $client = new \GuzzleHttp\Client();
147
            $json_response = $client->request('GET', $this->getUrl(), []);
148
            $response = json_decode( $json_response->getBody() );
149
        }
150
        catch (RequestException $e) {
151
            throw new RuntimeException('The request to the API failed: '.$e->getMessage(), $e->getCode(), $e);
152
        }
153
154
        if($response->{'ok'} === FALSE) {
155
            throw new RuntimeException('The request to the API failed: '.$response->{'error'}.".");
156
        }
157
158
        return $json_response->getBody();
159
    }
160
}
161