Stream   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
lcom 2
cbo 2
dl 0
loc 41
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A httpMethod() 0 4 1
A uri() 0 4 1
A toArray() 0 6 1
A queryResult() 0 7 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