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
01:56
created

Consumer   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 13
cts 13
cp 1
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A createConsumer() 4 4 1
A retrieveConsumer() 4 4 1
A listConsumers() 4 4 1
A updateConsumer() 4 4 1
A updateOrCreateConsumer() 4 4 1
A deleteConsumer() 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\Node;
13
14
use Unikorp\KongAdminApi\AbstractNode;
15
16
/**
17
 * consumer
18
 *
19
 * @author VEBER Arnaud <https://github.com/VEBERArnaud>
20
 */
21 View Code Duplication
class Consumer extends AbstractNode
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...
22
{
23
    /**
24
     * create consumer
25
     *
26
     * @param array $params
27
     *
28
     * @return \Psr\Http\Message\ResponseInterface
29
     */
30 1
    public function createConsumer(array $params)
31
    {
32 1
        $this->post('/consumers/', $params);
33 1
    }
34
35
    /**
36
     * retrieve consumer
37
     *
38
     * @param string $usernameOrId
39
     *
40
     * @return \Psr\Http\Message\ResponseInterface
41
     */
42 1
    public function retrieveConsumer($usernameOrId)
43
    {
44 1
        return $this->get(sprintf('/consumers/%1$s', $usernameOrId));
45
    }
46
47
    /**
48
     * list consumers
49
     *
50
     * @return \Psr\Http\Message\ResponseInterface
51
     */
52 1
    public function listConsumers()
53
    {
54 1
        return $this->get('/consumers/');
55
    }
56
57
    /**
58
     * update consumer
59
     *
60
     * @param string $usernameOrId
61
     * @param array $params
62
     *
63
     * @return \Psr\Http\Message\ResponseInterface
64
     */
65 1
    public function updateConsumer($usernameOrId, array $params)
66
    {
67 1
        return $this->patch(sprintf('/consumers/%1$s', $usernameOrId), $params);
68
    }
69
70
    /**
71
     * update or create consumer
72
     *
73
     * @param array $params
74
     *
75
     * @return \Psr\Http\Message\ResponseInterface
76
     */
77 1
    public function updateOrCreateConsumer(array $params)
78
    {
79 1
        return $this->put('/consumers/', $params);
80
    }
81
82
    /**
83
     * delete consumer
84
     *
85
     * @param string $usernameOrId
86
     *
87
     * @return \Psr\Http\Message\ResponseInterface
88
     */
89 1
    public function deleteConsumer($usernameOrId)
90
    {
91 1
        return $this->delete(sprintf('/consumers/%1$s', $usernameOrId));
92
    }
93
}
94