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.
Completed
Push — master ( 30655b...a8e9a1 )
by Romain
04:44
created

Emoji::list_emoji()   A

Complexity

Conditions 3
Paths 5

Size

Total Lines 20
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 20
rs 9.4285
cc 3
eloc 11
nc 5
nop 0
1
<?php
2
3
/*
4
 * This file is part of Slackify.
5
 *
6
 * (c) Strime <[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 Strime\Slackify\Api;
13
14
use Strime\Slackify\Exception\RuntimeException;
15
use Strime\Slackify\Exception\InvalidArgumentException;
16
use GuzzleHttp\Exception\RequestException;
17
18
class Emoji extends AbstractApi
19
{
20
    /**
21
     * {@inheritdoc}
22
     *
23
     * @return Emoji
24
     */
25
    public function list_emoji() {
26
27
        $this->setUrl("emoji.list");
28
29
        // Send the request
30
        try {
31
            $client = new \GuzzleHttp\Client();
32
            $json_response = $client->request('GET', $this->getUrl(), []);
33
            $response = json_decode( $json_response->getBody() );
34
        }
35
        catch (RequestException $e) {
36
            throw new RuntimeException('The request to the API failed: '.$e->getMessage(), $e->getCode(), $e);
37
        }
38
39
        if($response->{'ok'} === FALSE) {
40
            throw new RuntimeException('The request to the API failed: '.$response->{'error'}.".");
41
        }
42
43
        return $json_response->getBody();
44
    }
45
}
46