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

LowerThanLogic::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

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