Completed
Push — master ( fd0133...375486 )
by Beniamin
02:35
created

AbstractInsertBuilder   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 22
ccs 0
cts 5
cp 0
rs 10
c 0
b 0
f 0

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\TableComponentTrait;
25
26
    /**
27
     * @param mixed $table
28
     * @param array $columns
29
     *
30
     * @return AbstractTable
31
     */
32
    public function into($table, array $columns = [])
33
    {
34
        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...
35
            $this->setColumns($columns);
36
        }
37
38
        return $this->addRootTable($table);
39
    }
40
}