Ungroup   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 10
c 1
b 0
f 0
dl 0
loc 26
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 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\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