CommandStatus::uri()   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
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
declare(strict_types=1);
3
4
namespace Ytake\KsqlClient\Query;
5
6
use Fig\Http\Message\RequestMethodInterface;
7
use Psr\Http\Message\ResponseInterface;
8
use Ytake\KsqlClient\Result\AbstractResult;
9
use Ytake\KsqlClient\Result\CommandStatusResult;
10
11
/**
12
 * Class StatusCommand
13
 */
14
class CommandStatus implements QueryInterface
15
{
16
    /** @var string */
17
    protected $commandId;
18
19
    /**
20
     * @param string $commandId
21
     */
22
    public function __construct(string $commandId)
23
    {
24
        $this->commandId = $commandId;
25
    }
26
27
    /**
28
     * {@inheritdoc}
29
     */
30
    public function httpMethod(): string
31
    {
32
        return RequestMethodInterface::METHOD_GET;
33
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38
    public function uri(): string
39
    {
40
        return sprintf('status/%s', $this->commandId);
41
    }
42
43
    /**
44
     * {@inheritdoc}
45
     */
46
    public function toArray(): array
47
    {
48
        return [];
49
    }
50
51
    /**
52
     * @param ResponseInterface $response
53
     *
54
     * @return AbstractResult
55
     */
56
    public function queryResult(ResponseInterface $response): AbstractResult
57
    {
58
        return new CommandStatusResult($response);
59
    }
60
}
61