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

Plugin::deletePlugin()   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 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\Plugin as Document;
16
17
/**
18
 * plugin
19
 *
20
 * @author VEBER Arnaud <https://github.com/VEBERArnaud>
21
 */
22
class Plugin extends AbstractNode
23
{
24
    /**
25
     * add plugin
26
     *
27
     * @param string $nameOrId
28
     * @param \Unikorp\KongAdminApi\Document\Plugin $document
29
     *
30
     * @return \Psr\Http\Message\ResponseInterface
31
     */
32 1
    public function addPlugin($nameOrId, Document $document)
33
    {
34 1
        return $this->post(sprintf('/apis/%1$s/plugins/', $nameOrId), $document);
35
    }
36
37
    /**
38
     * retrieve plugin
39
     *
40
     * @param string $id
41
     *
42
     * @return \Psr\Http\Message\ResponseInterface
43
     */
44 1
    public function retrievePlugin($id)
45
    {
46 1
        return $this->get(sprintf('/plugins/%1$s', $id));
47
    }
48
49
    /**
50
     * list all plugins
51
     *
52
     * @return \Psr\Http\Message\ResponseInterface
53
     */
54 1
    public function listAllPlugins()
55
    {
56 1
        return $this->get('/plugins/');
57
    }
58
59
    /**
60
     * list plugins per api
61
     *
62
     * @param string $apiNameOrId
63
     *
64
     * @return \Psr\Http\Message\ResponseInterface
65
     */
66 1
    public function listPluginsPerApi($apiNameOrId)
67
    {
68 1
        return $this->get(sprintf('/apis/%1$s/plugins/', $apiNameOrId));
69
    }
70
71
    /**
72
     * update plugin
73
     *
74
     * @param string $apiNameOrId
75
     * @param string $id
76
     * @param \Unikorp\KongAdminApi\Document\Plugin $document
77
     *
78
     * @return \Psr\Http\Message\ResponseInterface
79
     */
80 1
    public function updatePlugin($apiNameOrId, $id, Document $document)
81
    {
82 1
        return $this->patch(sprintf('/apis/%1$s/plugins/%2$s', $apiNameOrId, $id), $document);
83
    }
84
85
    /**
86
     * update or add plugin
87
     *
88
     * @param string $apiNameOrId
89
     * @param \Unikorp\KongAdminApi\Document\Plugin $document
90
     *
91
     * @return \Psr\Http\Message\ResponseInterface
92
     */
93 1
    public function updateOrAddPlugin($apiNameOrId, Document $document)
94
    {
95 1
        return $this->put(sprintf('/apis/%1$s/plugins/', $apiNameOrId), $document);
96
    }
97
98
    /**
99
     * delete plugin
100
     *
101
     * @param string $apiNameOrId
102
     * @param string $id
103
     *
104
     * @return \Psr\Http\Message\ResponseInterface
105
     */
106 1
    public function deletePlugin($apiNameOrId, $id)
107
    {
108 1
        return $this->delete(sprintf('/apis/%1$s/plugins/%2$s', $apiNameOrId, $id));
109
    }
110
111
    /**
112
     * retrieve enabled plugin
113
     *
114
     * @return \Psr\Http\Message\ResponseInterface
115
     */
116 1
    public function retrieveEnabledPlugin()
117
    {
118 1
        return $this->get('/plugins/enabled');
119
    }
120
121
    /**
122
     * retrieve plugin schema
123
     *
124
     * @param string $pluginName
125
     *
126
     * @return \Psr\Http\Message\ResponseInterface
127
     */
128 1
    public function retrievePluginSchema($pluginName)
129
    {
130 1
        return $this->get(sprintf('/plugins/schema/%1$s', $pluginName));
131
    }
132
}
133