Completed
Push — master ( d89f57...64f474 )
by Rasmus
02:19
created

PostgresUpdateQuery::getSQL()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 8
Ratio 100 %

Code Coverage

Tests 4
CRAP Score 2.032

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 8
loc 8
ccs 4
cts 5
cp 0.8
rs 9.4285
cc 2
eloc 5
nc 2
nop 0
crap 2.032
1
<?php
2
3
namespace mindplay\sql\postgres;
4
5
use mindplay\sql\framework\MapperProvider;
6
use mindplay\sql\model\components\Returning;
7
use mindplay\sql\model\components\ReturnVars;
8
use mindplay\sql\model\Driver;
9
use mindplay\sql\model\query\UpdateQuery;
10
use mindplay\sql\model\schema\Table;
11
use mindplay\sql\model\TypeProvider;
12
13 View Code Duplication
class PostgresUpdateQuery extends UpdateQuery implements MapperProvider
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
14
{
15
    use Returning;
16
17
    /**
18
     * @param Driver       $driver
19
     * @param TypeProvider $types
20
     * @param Table        $table
21
     */
22 1
    public function __construct(Driver $driver, TypeProvider $types, Table $table)
23
    {
24 1
        parent::__construct($table, $driver, $types);
25
        
26 1
        $this->return_vars = new ReturnVars($table, $driver, $types);
27 1
    }
28
29
    /**
30
     * @inheritdoc
31
     */
32 1
    public function getSQL()
33
    {
34 1
        $returning = $this->return_vars->hasReturnVars()
35
            ? "\nRETURNING " . $this->return_vars->buildReturnVars()
36 1
            : "";
37
38 1
        return parent::getSQL() . $returning;
39
    }
40
}
41