AgentCheckUpdater::signature()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 * /agent/check/[status]
4
 * User: moyo
5
 * Date: 18/09/2017
6
 * Time: 5:17 PM
7
 */
8
9
namespace Carno\Consul\APIs;
10
11
use Carno\Consul\Features\Signature;
12
use Carno\Consul\Results\Failed;
13
use Carno\Consul\Results\Success;
14
use Carno\Promise\Promised;
15
16
class AgentCheckUpdater extends AbstractGate
17
{
18
    public const PASS = 'pass';
19
    public const WARN = 'warn';
20
    public const FAIL = 'fail';
21
22
    /**
23
     * @var string
24
     */
25
    protected $method = 'PUT';
26
27
    /**
28
     * @var string
29
     */
30
    protected $uri = '/agent/check/:status/:cid';
31
32
    /**
33
     * @param string $cid
34
     * @param string $status
35
     * @return static
36
     */
37
    public function related(string $cid, string $status) : self
38
    {
39
        $this->setVars('cid', $cid);
40
        $this->setVars('status', $status);
41
        return $this;
42
    }
43
44
    /**
45
     * @return static
46
     */
47
    public function signature() : self
48
    {
49
        $this->setQuery('note', Signature::gen());
50
        return $this;
51
    }
52
53
    /**
54
     * @return Promised|Success|Failed
55
     */
56
    public function result()
57
    {
58
        return $this->simpleHCodeResult();
59
    }
60
}
61