Test Failed
Pull Request — master (#62)
by Timon
06:14 queued 03:05
created

NotLogic   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A toArray() 0 7 1
A __construct() 0 9 1
1
<?php
2
3
namespace TBolier\RethinkQL\Query\Logic;
4
5
use TBolier\RethinkQL\Query\Operation\AbstractOperation;
6
use TBolier\RethinkQL\Query\QueryInterface;
7
use TBolier\RethinkQL\RethinkInterface;
8
use TBolier\RethinkQL\Types\Term\TermType;
9
10
class NotLogic extends AbstractOperation
11
{
12
    /**
13
     * @var QueryInterface
14
     */
15
    private $query;
16
17
    /**
18
     * @param RethinkInterface $rethink
19
     * @param QueryInterface $query
20
     * @param mixed $value
21
     */
22
    public function __construct(
23
        RethinkInterface $rethink,
24
        QueryInterface $query
25
    ) {
26
        parent::__construct($rethink);
27
28
        $this->rethink = $rethink;
29
        
30
        $this->query = $query;
31
    }
32
33
    /**
34
     * @inheritdoc
35
     */
36
    public function toArray(): array
37
    {
38
        return
39
            [
40
                TermType::NOT,
41
                [
42
                    $this->query->toArray(),
43
                ],
44
            ];
45
    }
46
}
47