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
Push — master ( 861dcb...319287 )
by VEBER
11s
created

TargetNode::addTarget()   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 Psr\Http\Message\ResponseInterface;
15
use Unikorp\KongAdminApi\AbstractNode;
16
use Unikorp\KongAdminApi\Document\TargetDocument as Document;
17
18
/**
19
 * target node
20
 *
21
 * @author VEBER Arnaud <https://github.com/VEBERArnaud>
22
 */
23
class TargetNode extends AbstractNode
24
{
25
    /**
26
     * add target
27
     *
28
     * @param string $nameOrId
29
     * @param \Unikorp\KongAdminApi\Document\TargetDocument $document
30
     *
31
     * @return \Psr\Http\Message\ResponseInterface
32
     */
33 2
    public function addTarget(string $nameOrId, Document $document): ResponseInterface
34
    {
35 2
        return $this->post(sprintf('/upstreams/%1$s/targets', $nameOrId), $document);
36
    }
37
38
    /**
39
     * list targets
40
     *
41
     * @param string $nameOrId
42
     * @param \Unikorp\KongAdminApi\Document\TargetDocument $document
43
     *
44
     * @return \Psr\Http\Message\ResponseInterface
45
     */
46 1
    public function listTargets(string $nameOrId, Document $document = null): ResponseInterface
47
    {
48 1
        return $this->get(sprintf('/upstreams/%1$s/targets', $nameOrId), $document);
49
    }
50
51
    /**
52
     * list active targets
53
     *
54
     * @param string $nameOrId
55
     *
56
     * @return \Psr\Http\Message\ResponseInterface
57
     */
58 2
    public function listActiveTargets(string $nameOrId): ResponseInterface
59
    {
60 2
        return $this->get(sprintf('/upstreams/%1$s/targets/active', $nameOrId));
61
    }
62
63
    /**
64
     * delete target
65
     *
66
     * @param string $nameOrId
67
     * @param string $target
68
     *
69
     * @return \Psr\Http\Message\ResponseInterface
70
     */
71 1
    public function deleteTarget(string $nameOrId, string $target): ResponseInterface
72
    {
73 1
        return $this->delete(sprintf('/upstreams/%1$s/targets/%2$s', $nameOrId, $target));
74
    }
75
}
76