By   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 28
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 28
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0

3 Methods

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