SelectColumns   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 1
dl 0
loc 25
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A add() 0 7 2
A hasAny() 0 4 1
A build() 0 7 2
1
<?php
2
declare(strict_types=1);
3
4
namespace Sirius\Sql\Component;
5
6
class SelectColumns extends Component
7
{
8
    protected $list = [];
9
10 16
    public function add(string $expr, string ...$exprs): void
11
    {
12 16
        $this->list[] = $expr;
13 16
        foreach ($exprs as $expr) {
14 4
            $this->list[] = $expr;
15
        }
16 16
    }
17
18 1
    public function hasAny(): bool
19
    {
20 1
        return ! empty($this->list);
21
    }
22
23 16
    public function build(): string
24
    {
25 16
        if (empty($this->list)) {
26 2
            return $this->indentCsv(['*']);
27
        }
28 15
        return $this->indentCsv($this->list);
29
    }
30
}
31