Flags   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 90.91%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A set() 0 8 2
A get() 0 4 1
A build() 0 8 2
1
<?php
2
declare(strict_types=1);
3
4
namespace Sirius\Sql\Component;
5
6
class Flags extends Component
7
{
8
    protected $list = [];
9
10 2
    public function set(string $flag, bool $enable = true): void
11
    {
12 2
        if ($enable) {
13 2
            $this->list[$flag] = true;
14
        } else {
15
            unset($this->list[$flag]);
16
        }
17 2
    }
18
19 2
    public function get(): array
20
    {
21 2
        return array_keys($this->list);
22
    }
23
24 19
    public function build(): string
25
    {
26 19
        if (empty($this->list)) {
27 17
            return '';
28
        }
29
30 2
        return ' ' . implode(' ', $this->get());
31
    }
32
}
33