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
Pull Request — master (#2)
by VEBER
03:58
created

AbstractApi::post()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 3
cts 3
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 2
crap 1
1
<?php
2
3
/*
4
 * This file is part of the KongAdminApi package.
5
 *
6
 * (c) Unikorp <https://github.com/unikorp>
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 Unikorp\KongAdminApi;
13
14
/**
15
 * abstract api
16
 *
17
 * @author VEBER Arnaud <https://github.com/VEBERArnaud>
18
 */
19
class AbstractApi implements ApiInterface
20
{
21
    /**
22
     * client
23
     * @var \Unikorp\KongAdminApi\Client $client
24
     */
25
    private $client = null;
26
27
    /**
28
     * Constructor
29
     *
30
     * @param \Unikorp\KongAdminApi\Client $client
31
     */
32 5
    public function __construct(Client $client)
33
    {
34 5
        $this->client = $client;
35 5
    }
36
37
    /**
38
     * get
39
     *
40
     * @param string $endpoint
41
     *
42
     * @return \Psr\Http\Message\ResponseInterface
43
     */
44 12
    protected function get($endpoint)
45
    {
46 12
        return $this->client->getHttpClient()->get($endpoint);
47
    }
48
49
    /**
50
     * post
51
     *
52
     * @param string $endpoint
53
     * @param array $body
54
     *
55
     * @return \Psr\Http\Message\ResponseInterface
56
     */
57 3
    protected function post($endpoint, array $body = [])
58
    {
59 3
        return $this->client->getHttpClient()->post(
60
            $endpoint,
61 3
            ['Content-Type' => 'application/json'],
62
            json_encode($body)
63
        );
64
    }
65
66
    /**
67
     * put
68
     *
69
     * @param string $endpoint
70
     * @param array $body
71
     *
72
     * @return \Psr\Http\Message\ResponseInterface
73
     */
74 3
    protected function put($endpoint, array $body = [])
75
    {
76 3
        return $this->client->getHttpClient()->put(
77
            $endpoint,
78 3
            ['Content-Type' => 'application/json'],
79
            json_encode($body)
80
        );
81
    }
82
83
    /**
84
     * patch
85
     *
86
     * @param string $endpoint
87
     * @param array $body
88
     *
89
     * @return \Psr\Http\Message\ResponseInterface
90
     */
91 3
    protected function patch($endpoint, array $body = [])
92
    {
93 3
        return $this->client->getHttpClient()->patch(
94
            $endpoint,
95 3
            ['Content-Type' => 'application/json'],
96
            json_encode($body)
97
        );
98
    }
99
100
    /**
101
     * delete
102
     *
103
     * @param string $endpoint
104
     *
105
     * @return \Psr\Http\Message\ResponseInterface
106
     */
107 4
    protected function delete($endpoint, array $body = [])
108
    {
109 4
        return $this->client->getHttpClient()->delete(
110
            $endpoint,
111 4
            ['Content-Type' => 'application/json'],
112
            json_encode($body)
113
        );
114
    }
115
}
116