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

IntoTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 36
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A into() 0 6 1
A buildInto() 0 6 1
getType() 0 1 ?
getClause() 0 1 ?
buildClause() 0 6 ?
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\Traits\Clause;
16
17
use Phossa2\Query\Interfaces\Clause\IntoInterface;
18
19
/**
20
 * IntoTrait
21
 *
22
 * Implementation of IntoInterface
23
 *
24
 * @package Phossa2\Query
25
 * @author  Hong Zhang <[email protected]>
26
 * @see     IntoInterface
27
 * @version 2.0.0
28
 * @since   2.0.0 added
29
 */
30
trait IntoTrait
31
{
32
    /**
33
     * {@inheritDoc}
34
     */
35
    public function into(/*# string */ $table)
36
    {
37
        $clause = &$this->getClause('INTO');
38
        $clause[] = [$table, false];
39
        return $this;
40
    }
41
42
    /**
43
     * Build INTO
44
     *
45
     * @param  string $prefix
46
     * @param  array $settings
47
     * @return string
48
     * @access protected
49
     */
50
    protected function buildInto(
51
        /*# string */ $prefix,
52
        array $settings
53
    )/*# : string */ {
54
        return $this->buildClause('INTO', $prefix, $settings);
55
    }
56
57
    abstract protected function getType()/*# : string */;
58
    abstract protected function &getClause(/*# string */ $clauseName)/*# : array */;
59
    abstract protected function buildClause(
60
        /*# string */ $clauseName,
61
        /*# string */ $clausePrefix,
62
        array $settings,
63
        array $clauseParts = []
64
    )/*# string */;
65
}
66