Completed
Push — master ( 3152a4...36e9e8 )
by Hong
02:25
created

Expression::buildSql()   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 1
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\Misc;
16
17
use Phossa2\Query\Traits\Clause\OnTrait;
18
use Phossa2\Query\Traits\StatementAbstract;
19
use Phossa2\Query\Traits\Clause\WhereTrait;
20
use Phossa2\Query\Traits\Clause\ClauseTrait;
21
use Phossa2\Query\Interfaces\BuilderInterface;
22
use Phossa2\Query\Interfaces\ExpressionInterface;
23
24
/**
25
 * Expression
26
 *
27
 * @package Phossa2\Query
28
 * @author  Hong Zhang <[email protected]>
29
 * @see     ExpressionInterface
30
 * @version 2.0.0
31
 * @since   2.0.0 added
32
 */
33
class Expression extends StatementAbstract implements ExpressionInterface
34
{
35
    use ClauseTrait, WhereTrait, OnTrait;
36
37
    /**
38
     * {@inheritDoc}
39
     */
40
    public function __construct(BuilderInterface $builder)
41
    {
42
        parent::__construct($builder);
43
44
        // force flat notation
45
        $this->setSettings(['seperator' => ' ', 'indent' => '']);
46
    }
47
48
    /**
49
     * {@inheritDoc}
50
     */
51
    protected function buildSql(array $settings)/*# : string */
52
    {
53
        return '(' . parent::buildSql($settings) . ')';
54
    }
55
56
    /**
57
     * {@inheritDoc}
58
     */
59
    protected function getConfigs()/*# : array */
60
    {
61
        return ['WHERE', 'ON'];
62
    }
63
}
64