GroupBy   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 29
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A add() 0 4 1
A name() 0 3 1
A __construct() 0 4 1
A __toString() 0 3 1
1
<?php
2
3
namespace HexMakina\Crudites\Grammar\Clause;
4
5
use HexMakina\Crudites\Grammar\Deck;
6
7
class GroupBy extends Clause
8
{
9
    private Deck $deck;
10
11
    /**
12
     * GroupBy constructor.
13
     *
14
     * @param mixed $selected The selected columns or expressions for the GROUP BY clause.
15
     */
16
    public function __construct($selected)
17
    {
18
        parent::__construct();
19
        $this->deck = new Deck($selected);
20
    }
21
22
    public function add(...$selected): self
23
    {
24
        $this->deck->add(array_pop($selected));
25
        return $this;
26
    }
27
28
    public function __toString(): string
29
    {
30
        return 'GROUP BY ' . $this->deck;
31
    }
32
33
    public function name(): string
34
    {
35
        return self::GROUP;
36
    }
37
}
38