GroupBy::name()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
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