Completed
Push — master ( b794f5...f9eb18 )
by Andrii
03:04
created

Connection   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 3
dl 0
loc 15
ccs 0
cts 10
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A createSelect() 0 4 1
A buildExpression() 0 7 1
1
<?php
2
/**
3
 * HiAPI Yii2 base project for building API
4
 *
5
 * @link      https://github.com/hiqdev/hiapi
6
 * @package   hiapi
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2017, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hiapi\components;
12
13
use hiapi\db\ExpressionInterface;
14
use yii\db\Expression;
15
use yii\db\Query;
16
17
class Connection extends \yii\db\Connection implements ConnectionInterface
18
{
19
    public function createSelect(ExpressionInterface $exp)
20
    {
21
        return (new Query)->select($this->buildExpression($exp));
22
    }
23
24
    public function buildExpression($exp)
25
    {
26
        $params = [];
27
        $string = $exp->buildUsing($this->getQueryBuilder(), $params);
28
29
        return new Expression($string, $params);
30
    }
31
}
32