Completed
Push — master ( e94e78...8fe297 )
by Beniamin
02:15
created

AbstractInsertBuilder::getColumns()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
/**
4
 * This file is part of UnderQuery 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\UnderQuery\QueryBuilder;
13
14
use Phuria\UnderQuery\Table\AbstractTable;
15
16
/**
17
 * @author Beniamin Jonatan Šimko <[email protected]>
18
 */
19
abstract class AbstractInsertBuilder extends AbstractBuilder
20
{
21
    /**
22
     * @var array
23
     */
24
    private $columns = [];
25
26
    /**
27
     * @param array $columns
28
     *
29
     * @return $this
30
     */
31 2
    public function setColumns($columns)
32
    {
33 2
        $this->columns = $columns;
34
35 2
        return $this;
36
    }
37
38
    /**
39
     * @param mixed $column
40
     *
41
     * @return $this
42
     */
43
    public function addColumn($column)
44
    {
45
        $this->columns[] = $column;
46
47
        return $this;
48
    }
49
50
    /**
51
     * @return array
52
     */
53 2
    public function getColumns()
54
    {
55 2
        return $this->columns;
56
    }
57
58
    /**
59
     * @param mixed $table
60
     * @param array $columns
61
     *
62
     * @return AbstractTable
63
     */
64 2
    public function into($table, array $columns = [])
65
    {
66 2
        if (count($columns)) {
67 1
            $this->setColumns($columns);
68 1
        }
69
70 2
        return $this->addRootTable($table);
71
    }
72
}