Stream::queryResult()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 1
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\StreamResult;
10
11
/**
12
 * Class StreamQuery
13
 */
14
final class Stream extends AbstractStreamQuery
15
{
16
    /**
17
     * {@inheritdoc}
18
     */
19
    public function httpMethod(): string
20
    {
21
        return RequestMethodInterface::METHOD_POST;
22
    }
23
24
    /**
25
     * {@inheritdoc}
26
     */
27
    public function uri(): string
28
    {
29
        return 'query';
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    public function toArray(): array
36
    {
37
        return [
38
            'ksql' => $this->query,
39
        ];
40
    }
41
42
    /**
43
     * @param ResponseInterface $response
44
     *
45
     * @return AbstractResult
46
     */
47
    public function queryResult(ResponseInterface $response): AbstractResult
48
    {
49
        $stream = new StreamResult($response);
50
        $stream->setCallback($this->callback);
51
52
        return $stream;
53
    }
54
}
55