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

IsEmpty::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 3
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