Passed
Push — master ( 112cee...b68050 )
by Michel
03:20
created

Ungroup::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
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\QueryInterface;
8
use TBolier\RethinkQL\Query\Transformation\AbstractTransformationCompound;
9
use TBolier\RethinkQL\RethinkInterface;
10
use TBolier\RethinkQL\Types\Term\TermType;
11
12
class Ungroup extends AbstractTransformationCompound
13
{
14
    /**
15
     * @var QueryInterface
16
     */
17
    private $query;
18
19
    /**
20
     * @param RethinkInterface $rethink
21
     * @param QueryInterface $query
22
     */
23
    public function __construct(
24
        RethinkInterface $rethink,
25
        QueryInterface $query
26
    ) {
27
        parent::__construct($rethink);
28
29
        $this->query = $query;
30
        $this->rethink = $rethink;
31
    }
32
33
    /**
34
     * @inheritdoc
35
     */
36
    public function toArray(): array
37
    {
38
        return [
39
            TermType::UNGROUP,
40
            [
41
                $this->query->toArray(),
42
            ],
43
        ];
44
    }
45
}
46