Completed
Push — master ( 31d87d...869318 )
by Beniamin
02:35
created

AbstractInsertBuilder   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 0
cbo 4
dl 0
loc 23
ccs 5
cts 5
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A into() 0 8 2
1
<?php
2
3
/**
4
 * This file is part of Phuria SQL Builder package.
5
 *
6
 * Copyright (c) 2016 Beniamin Jonatan Šimko
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Phuria\SQLBuilder\QueryBuilder;
13
14
use Phuria\SQLBuilder\Table\AbstractTable;
15
16
/**
17
 * @author Beniamin Jonatan Šimko <[email protected]>
18
 */
19
abstract class AbstractInsertBuilder extends AbstractBuilder implements
20
    Clause\InsertColumnsClauseInterface,
21
    Component\TableComponentInterface
22
{
23
    use Clause\InsertColumnsClauseTrait;
24
    use Component\QueryComponentTrait;
25
    use Component\TableComponentTrait;
26
27
    /**
28
     * @param mixed $table
29
     * @param array $columns
30
     *
31
     * @return AbstractTable
32
     */
33 3
    public function into($table, array $columns = [])
34
    {
35 3
        if ($columns) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $columns of type array is implicitly converted to a boolean; are you sure this is intended? If so, consider using ! empty($expr) instead to make it clear that you intend to check for an array without elements.

This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.

Consider making the comparison explicit by using empty(..) or ! empty(...) instead.

Loading history...
36 2
            $this->setColumns($columns);
37 2
        }
38
39 3
        return $this->addRootTable($table);
40
    }
41
}