Passed
Push — master ( e0d17a...139da0 )
by Michel
03:37
created

FuncLogic::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
c 0
b 0
f 0
rs 9.4285
cc 1
eloc 4
nc 1
nop 3
1
<?php
2
3
namespace TBolier\RethinkQL\Query\Logic;
4
5
use TBolier\RethinkQL\Message\MessageInterface;
6
use TBolier\RethinkQL\Query\AbstractQuery;
7
use TBolier\RethinkQL\Query\QueryInterface;
8
use TBolier\RethinkQL\RethinkInterface;
9
use TBolier\RethinkQL\Types\Term\TermType;
10
11
class FuncLogic extends AbstractQuery
12
{
13
    /**
14
     * @var QueryInterface
15
     */
16
    private $functions;
17
18
    /**
19
     * @param RethinkInterface $rethink
20
     * @param MessageInterface $message
21
     * @param QueryInterface $functions
22
     */
23
    public function __construct(
24
        RethinkInterface $rethink,
25
        MessageInterface $message,
26
        QueryInterface $functions
27
    ) {
28
        parent::__construct($rethink, $message);
29
30
        $this->functions = $functions;
31
        $this->rethink = $rethink;
32
        $this->message = $message;
33
    }
34
35
    /**
36
     * @inheritdoc
37
     */
38
    public function toArray(): array
39
    {
40
        return
41
            [
42
                TermType::FUNC,
43
                [
44
                    [
45
                        TermType::MAKE_ARRAY,
46
                        [
47
                            TermType::DATUM,
48
                        ],
49
                    ],
50
                    $this->functions->toArray(),
51
                ],
52
            ];
53
    }
54
}
55