InsertColumns::column()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Sirius\Sql\Clause;
5
6
use Sirius\Sql\Component\InsertColumns as InsertColumnsComponent;
7
8
trait InsertColumns
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 InsertColumnsComponent($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