Ksql::toArray()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
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\KsqlResult;
10
11
/**
12
 * Class Ksql
13
 */
14
class Ksql implements QueryInterface
15
{
16
    /** @var string */
17
    protected $query;
18
19
    /**
20
     * Ksql constructor.
21
     *
22
     * @param string $query
23
     */
24
    public function __construct(string $query)
25
    {
26
        $this->query = $query;
27
    }
28
29
    /**
30
     * {@inheritdoc}
31
     */
32
    public function httpMethod(): string
33
    {
34
        return RequestMethodInterface::METHOD_POST;
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40
    public function uri(): string
41
    {
42
        return 'ksql';
43
    }
44
45
    /**
46
     * {@inheritdoc}
47
     */
48
    public function toArray(): array
49
    {
50
        return [
51
            'ksql' => $this->query,
52
        ];
53
    }
54
55
    /**
56
     * @param ResponseInterface $response
57
     *
58
     * @return AbstractResult
59
     */
60
    public function queryResult(ResponseInterface $response): AbstractResult
61
    {
62
        return new KsqlResult($response);
63
    }
64
}
65