Ungroup::toArray()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 6
rs 10
cc 1
nc 1
nop 0
1
<?php
2
declare(strict_types=1);
3
4
namespace TBolier\RethinkQL\Query\Aggregation;
5
6
use TBolier\RethinkQL\Query\AbstractQuery;
7
use TBolier\RethinkQL\Query\Operation\OperationTrait;
8
use TBolier\RethinkQL\Query\QueryInterface;
9
use TBolier\RethinkQL\Query\Transformation\TransformationTrait;
10
use TBolier\RethinkQL\RethinkInterface;
11
use TBolier\RethinkQL\Types\Term\TermType;
12
13
class Ungroup extends AbstractQuery
14
{
15
    use TransformationTrait;
16
    use OperationTrait;
17
18
    /**
19
     * @var QueryInterface
20
     */
21
    private $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
    public function toArray(): array
34
    {
35
        return [
36
            TermType::UNGROUP,
37
            [
38
                $this->query->toArray(),
39
            ],
40
        ];
41
    }
42
}
43