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:29
created

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