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

AbstractAggregation   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 7
dl 0
loc 56
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A group() 0 3 1
A ungroup() 0 3 1
A count() 0 3 1
A avg() 0 3 1
A sum() 0 3 1
A min() 0 3 1
A max() 0 3 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\QueryInterface;
8
use TBolier\RethinkQL\Query\Transformation\TransformationCompoundInterface;
9
10
abstract class AbstractAggregation extends AbstractQuery implements AggregationInterface
11
{
12
    /**
13
     * @inheritdoc
14
     */
15
    public function count(): QueryInterface
16
    {
17
        return new Count($this->rethink, $this);
18
    }
19
20
    /**
21
     * @inheritdoc
22
     */
23
    public function group(string $key): TransformationCompoundInterface
24
    {
25
        return new Group($this->rethink, $this, $key);
26
    }
27
28
    /**
29
     * @inheritdoc
30
     */
31
    public function ungroup(): TransformationCompoundInterface
32
    {
33
        return new Ungroup($this->rethink, $this);
34
    }
35
36
    /**
37
     * @inheritdoc
38
     */
39
    public function sum(string $key): QueryInterface
40
    {
41
        return new Sum($this->rethink, $this, $key);
42
    }
43
44
    /**
45
     * @inheritdoc
46
     */
47
    public function avg(string $key): QueryInterface
48
    {
49
        return new Avg($this->rethink, $this, $key);
50
    }
51
52
    /**
53
     * @inheritdoc
54
     */
55
    public function min(string $key): AggregationInterface
56
    {
57
        return new Min($this->rethink, $this, $key);
58
    }
59
60
    /**
61
     * @inheritdoc
62
     */
63
    public function max(string $key): TransformationCompoundInterface
64
    {
65
        return new Max($this->rethink, $this, $key);
66
    }
67
}
68