Failed Conditions
Pull Request — master (#34)
by Marc
03:16
created

IsEmpty   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

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

2 Methods

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