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

FuncLogic   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 40
c 0
b 0
f 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 1
A toArray() 0 13 1
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