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

Api::addApi()   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 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\Node;
13
14
use Unikorp\KongAdminApi\AbstractNode;
15
use Unikorp\KongAdminApi\Document\Api as Document;
16
17
/**
18
 * api
19
 *
20
 * @author VEBER Arnaud <https://github.com/VEBERArnaud>
21
 */
22
class Api extends AbstractNode
23
{
24
    /**
25
     * add api
26
     *
27
     * @param \Unikorp\KongAdminApi\Document\Api $document
28
     *
29
     * @return \Psr\Http\Message\ResponseInterface
30
     */
31 1
    public function addApi(Document $document)
32
    {
33 1
        return $this->post('/apis/', $document);
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 \Unikorp\KongAdminApi\Document\Api $document
63
     *
64
     * @return \Psr\Http\Message\ResponseInterface
65
     */
66 1
    public function updateApi($nameOrId, Document $document)
67
    {
68 1
        return $this->patch(sprintf('/apis/%1$s', $nameOrId), $document);
69
    }
70
71
    /**
72
     * update or create api
73
     *
74
     * @param \Unikorp\KongAdminApi\Document\Api $document
75
     *
76
     * @return \Psr\Http\Message\ResponseInterface
77
     */
78 1
    public function updateOrCreateApi(Document $document)
79
    {
80 1
        return $this->put('/apis/', $document);
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