Completed
Push — 2.0 ( 1160ec...acba87 )
by Vermeulen
05:15
created

ColumnValueList::generate()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 14

Duplication

Lines 14
Ratio 100 %

Importance

Changes 0
Metric Value
dl 14
loc 14
c 0
b 0
f 0
rs 9.7998
cc 3
nc 3
nop 0
1
<?php
2
3
namespace BfwSql\Queries\Parts;
4
5
class ColumnValueList extends ColumnList
6
{
7
    /**
8
     * {@inheritdoc}
9
     * 
10
     * @param array $columns The list of columns to declare
11
     *  The key into the array is the name of the column.
12
     *  The value is the column value.
13
     */
14
    public function __invoke(array $columns)
15
    {
16
        foreach ($columns as $name => $value) {
17
            $this->list[] = new Column($this->table, $name, null, $value);
18
        }
19
    }
20
    
21
    /**
22
     * {@inheritdoc}
23
     */
24 View Code Duplication
    public function generate(): string
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
25
    {
26
        $sqlPart = '';
27
        
28
        foreach ($this->list as $index => $column) {
29
            if ($index > 0) {
30
                $sqlPart .= $this->separator;
31
            }
32
            
33
            $sqlPart .= $column->obtainName().'='.$column->obtainValue();
34
        }
35
        
36
        return $sqlPart;
37
    }
38
}
39