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

Api   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 73
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 1
dl 73
loc 73
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A addApi() 4 4 1
A retrieveApi() 4 4 1
A listApis() 4 4 1
A updateApi() 4 4 1
A updateOrCreateApi() 4 4 1
A deleteApi() 4 4 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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\Api;
13
14
use Unikorp\KongAdminApi\AbstractApi;
15
use Unikorp\KongAdminApi\Client;
16
17
/**
18
 * api
19
 *
20
 * @author VEBER Arnaud <https://github.com/VEBERArnaud>
21
 */
22 View Code Duplication
class Api extends AbstractApi
0 ignored issues
show
Duplication introduced by
This class 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...
23
{
24
    /**
25
     * add api
26
     *
27
     * @param array $params
28
     *
29
     * @return \Psr\Http\Message\ResponseInterface
30
     */
31 1
    public function addApi(array $params)
32
    {
33 1
        return $this->post('/apis/', $params);
34
    }
35
36
    /**
37
     * retrieve api
38
     *
39
     * @param string $nameOrId
40
     *
41
     * @return \Psr\Http\Message\ResponseInterface
42
     */
43 1
    public function retrieveApi($nameOrId)
44
    {
45 1
        return $this->get(sprintf('/apis/%1$s', $nameOrId));
46
    }
47
48
    /**
49
     * list apis
50
     *
51
     * @return \Psr\Http\Message\ResponseInterface
52
     */
53 1
    public function listApis()
54
    {
55 1
        return $this->get('/apis/');
56
    }
57
58
    /**
59
     * update api
60
     *
61
     * @param string $nameOrId
62
     * @param array $params
63
     *
64
     * @return \Psr\Http\Message\ResponseInterface
65
     */
66 1
    public function updateApi($nameOrId, array $params)
67
    {
68 1
        return $this->patch(sprintf('/apis/%1$s', $nameOrId), $params);
69
    }
70
71
    /**
72
     * update or create api
73
     *
74
     * @param array $params
75
     *
76
     * @return \Psr\Http\Message\ResponseInterface
77
     */
78 1
    public function updateOrCreateApi(array $params)
79
    {
80 1
        return $this->put('/apis/', $params);
81
    }
82
83
    /**
84
     * delete api
85
     *
86
     * @param string $nameOrId
87
     *
88
     * @return \Psr\Http\Message\ResponseInterface
89
     */
90 1
    public function deleteApi($nameOrId)
91
    {
92 1
        return $this->delete(sprintf('/apis/%1$s', $nameOrId));
93
    }
94
}
95