UpdateColumns   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 1
dl 0
loc 36
ccs 14
cts 14
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A column() 0 6 1
A columns() 0 12 3
A hasColumns() 0 4 1
A resetColumns() 0 6 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Sirius\Sql\Clause;
5
6
use Sirius\Sql\Component\UpdateColumns as UpdateColumnsComponent;
7
8
trait UpdateColumns
9
{
10
    protected $columns;
11
12 1
    public function column(string $column, ...$value)
13
    {
14 1
        $this->columns->hold($column, ...$value);
15
16 1
        return $this;
17
    }
18
19 1
    public function columns(array $columns)
20
    {
21 1
        foreach ($columns as $key => $val) {
22 1
            if (is_int($key)) {
23 1
                $this->column($val);
24
            } else {
25 1
                $this->column($key, $val);
26
            }
27
        }
28
29 1
        return $this;
30
    }
31
32 1
    public function hasColumns(): bool
33
    {
34 1
        return $this->columns->hasAny();
35
    }
36
37 1
    public function resetColumns()
38
    {
39 1
        $this->columns = new UpdateColumnsComponent($this->bindings, $this->quoter);
0 ignored issues
show
Bug introduced by
The property bindings does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
Bug introduced by
The property quoter does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
40
41 1
        return $this;
42
    }
43
}
44