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 ( beaba1...b637a0 )
by VEBER
17s
created

AbstractNode::get()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
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 node
16
 *
17
 * @author VEBER Arnaud <https://github.com/VEBERArnaud>
18
 */
19
abstract class AbstractNode implements NodeInterface
20
{
21
    /**
22
     * json content type
23
     * @const array JSON_CONTENT_TYPE
24
     */
25
    const JSON_CONTENT_TYPE = [
26
        'Content-Type' => 'application/json',
27
    ];
28
29
    /**
30
     * client
31
     * @var \Unikorp\KongAdminApi\Client $client
32
     */
33
    private $client = null;
34
35
    /**
36
     * Constructor
37
     *
38
     * @param \Unikorp\KongAdminApi\Client $client
39
     */
40 5
    public function __construct(Client $client)
41
    {
42 5
        $this->client = $client;
43 5
    }
44
45
    /**
46
     * get
47
     *
48
     * @param string $endpoint
49
     *
50
     * @return \Psr\Http\Message\ResponseInterface
51
     */
52 12
    protected function get($endpoint)
53
    {
54 12
        return $this->client->getHttpClient()->get($endpoint);
55
    }
56
57
    /**
58
     * post
59
     *
60
     * @param string $endpoint
61
     * @param DocumentInterface $document
62
     *
63
     * @return \Psr\Http\Message\ResponseInterface
64
     */
65 3 View Code Duplication
    protected function post($endpoint, DocumentInterface $document = null)
1 ignored issue
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
66
    {
67 3
        return $this->client->getHttpClient()->post(
68 3
            $endpoint,
69 3
            self::JSON_CONTENT_TYPE,
70 3
            $document ? $document->toJson() : '[]'
71
        );
72
    }
73
74
    /**
75
     * put
76
     *
77
     * @param string $endpoint
78
     * @param DocumentInterface $document
79
     *
80
     * @return \Psr\Http\Message\ResponseInterface
81
     */
82 3 View Code Duplication
    protected function put($endpoint, DocumentInterface $document = null)
1 ignored issue
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
83
    {
84 3
        return $this->client->getHttpClient()->put(
85 3
            $endpoint,
86 3
            self::JSON_CONTENT_TYPE,
87 3
            $document ? $document->toJson() : '[]'
88
        );
89
    }
90
91
    /**
92
     * patch
93
     *
94
     * @param string $endpoint
95
     * @param DocumentInterface $document
96
     *
97
     * @return \Psr\Http\Message\ResponseInterface
98
     */
99 3 View Code Duplication
    protected function patch($endpoint, DocumentInterface $document = null)
1 ignored issue
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
100
    {
101 3
        return $this->client->getHttpClient()->patch(
102 3
            $endpoint,
103 3
            self::JSON_CONTENT_TYPE,
104 3
            $document ? $document->toJson() : '[]'
105
        );
106
    }
107
108
    /**
109
     * delete
110
     *
111
     * @param string $endpoint
112
     * @param DocumentInterface $document
113
     *
114
     * @return \Psr\Http\Message\ResponseInterface
115
     */
116 4 View Code Duplication
    protected function delete($endpoint, DocumentInterface $document = null)
1 ignored issue
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
117
    {
118 4
        return $this->client->getHttpClient()->delete(
119 4
            $endpoint,
120 4
            self::JSON_CONTENT_TYPE,
121 4
            $document ? $document->toJson() : '[]'
122
        );
123
    }
124
}
125