Completed
Push — master ( 226980...c1625e )
by Hong
02:50
created

Insert::getType()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
/**
3
 * Phossa Project
4
 *
5
 * PHP version 5.4
6
 *
7
 * @category  Library
8
 * @package   Phossa2\Query
9
 * @copyright Copyright (c) 2016 phossa.com
10
 * @license   http://mit-license.org/ MIT License
11
 * @link      http://www.phossa.com/
12
 */
13
/*# declare(strict_types=1); */
14
15
namespace Phossa2\Query\Dialect\Common;
16
17
use Phossa2\Query\Traits\Clause\SetTrait;
18
use Phossa2\Query\Traits\Clause\IntoTrait;
19
use Phossa2\Query\Traits\StatementAbstract;
20
use Phossa2\Query\Traits\Clause\ClauseTrait;
21
use Phossa2\Query\Interfaces\Statement\InsertStatementInterface;
22
use Phossa2\Query\Interfaces\Statement\SelectStatementInterface;
23
24
/**
25
 * Insert
26
 *
27
 * @package Phossa2\Query
28
 * @author  Hong Zhang <[email protected]>
29
 * @see     StatementAbstract
30
 * @see     InsertStatementInterface
31
 * @see     SelectStatementInterface
32
 * @version 2.0.0
33
 * @since   2.0.0 added
34
 */
35
class Insert extends StatementAbstract implements InsertStatementInterface
36
{
37
    use ClauseTrait, IntoTrait, SetTrait;
38
39
    /**
40
     * {@inheritDoc}
41
     */
42
    protected $configs = [
43
        'INTO' => 'INTO',
44
        'SET' => '',
45
        'VALUES' => 'VALUES',
46
    ];
47
48
    /**
49
     * INSERT ... SELECT
50
     *
51
     * {@inheritDoc}
52
     */
53
    public function select(
54
        $col = '',
55
        /*# string */ $alias = ''
56
    )/*# : SelectStatementInterface */ {
57
        return $this->getBuilder()->select($col, $alias)->table('')->setPrevious($this);
58
    }
59
60
    /**
61
     * {@inheritDoc}
62
     */
63
    protected function getType()/*# : string */
64
    {
65
        return 'INSERT';
66
    }
67
}
68