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   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A list_emoji() 0 20 3
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