Passed
Push — master ( 139da0...112cee )
by Michel
03:17
created

FilterByRow::toArray()   A

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 0
1
<?php
2
declare(strict_types=1);
3
4
namespace TBolier\RethinkQL\Query\Operation;
5
6
use TBolier\RethinkQL\Message\MessageInterface;
7
use TBolier\RethinkQL\Query\QueryInterface;
8
use TBolier\RethinkQL\Query\Transformation\AbstractTransformationCompound;
9
use TBolier\RethinkQL\RethinkInterface;
10
use TBolier\RethinkQL\Types\Term\TermType;
11
12
class FilterByRow extends AbstractTransformationCompound
13
{
14
    /**
15
     * @var QueryInterface
16
     */
17
    private $functionQuery;
18
19
    /**
20
     * @var QueryInterface
21
     */
22
    private $query;
23
24
    /**
25
     * @param RethinkInterface $rethink
26
     * @param MessageInterface $message
27
     * @param QueryInterface $query
28
     * @param QueryInterface $manipulation
29
     */
30
    public function __construct(
31
        RethinkInterface $rethink,
32
        MessageInterface $message,
33
        QueryInterface $query,
34
        QueryInterface $manipulation
35
    ) {
36
        parent::__construct($rethink, $message);
37
38
        $this->query = $query;
39
        $this->functionQuery = $manipulation;
40
        $this->rethink = $rethink;
41
        $this->message = $message;
42
    }
43
44
    /**
45
     * @inheritdoc
46
     */
47
    public function toArray(): array
48
    {
49
        return [
50
            TermType::FILTER,
51
            [
52
                $this->query->toArray(),
53
                $this->functionQuery->toArray(),
54
            ],
55
        ];
56
    }
57
}
58