Completed
Push — master ( 12c942...31d87d )
by Beniamin
02:36
created

InsertBuilder::into()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 5
cts 5
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 2
crap 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
class InsertBuilder extends AbstractBuilder implements
20
    Clause\InsertColumnsClauseInterface,
21
    Component\InsertValuesComponentInterface,
22
    Component\QueryComponentInterface,
23
    Component\TableComponentInterface
24
{
25
    use Clause\InsertColumnsClauseTrait;
26
    use Component\InsertValuesComponentTrait;
27
    use Component\QueryComponentTrait;
28
    use Component\TableComponentTrait;
29
30
    /**
31
     * @param mixed $table
32
     * @param array $columns
33
     *
34
     * @return AbstractTable
35
     */
36 2
    public function into($table, array $columns = [])
37
    {
38 2
        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...
39 1
            $this->setColumns($columns);
40 1
        }
41
42 2
        return $this->addRootTable($table);
43
    }
44
}