Max   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 1
A toArray() 0 7 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\Manipulation\LogicTrait;
8
use TBolier\RethinkQL\Query\Operation\OperationTrait;
9
use TBolier\RethinkQL\Query\QueryInterface;
10
use TBolier\RethinkQL\Query\Transformation\TransformationTrait;
11
use TBolier\RethinkQL\RethinkInterface;
12
use TBolier\RethinkQL\Types\Term\TermType;
13
14
class Max extends AbstractQuery
15
{
16
    use TransformationTrait;
17
    use OperationTrait;
18
    use LogicTrait;
19
20
    /**
21
     * @var string
22
     */
23
    private $key;
24
25
    /**
26
     * @var QueryInterface
27
     */
28
    private $query;
29
30
    public function __construct(
31
        RethinkInterface $rethink,
32
        QueryInterface $query,
33
        string $key
34
    ) {
35
        parent::__construct($rethink);
36
37
        $this->query = $query;
38
        $this->key = $key;
39
        $this->rethink = $rethink;
40
    }
41
42
    public function toArray(): array
43
    {
44
        return [
45
            TermType::MAX,
46
            [
47
                $this->query->toArray(),
48
                $this->key,
49
            ],
50
        ];
51
    }
52
}
53