PostgresDeleteQuery::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 2
c 1
b 0
f 1
nc 1
nop 3
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
rs 10
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\DeleteQuery;
10
use mindplay\sql\model\schema\Table;
11
use mindplay\sql\model\TypeProvider;
12
13
class PostgresDeleteQuery extends DeleteQuery implements MapperProvider
14
{
15
    use Returning;
16
17 1
    public function __construct(Table $table, Driver $driver, TypeProvider $types)
18
    {
19 1
        parent::__construct($table, $types);
20
21 1
        $this->return_vars = new ReturnVars($table, $driver, $types);
22
    }
23
24
    /**
25
     * @inheritdoc
26
     */
27 1
    public function getSQL(): string
28
    {
29 1
        $returning = $this->return_vars->hasReturnVars()
30
            ? "\nRETURNING " . $this->return_vars->buildReturnVars()
31 1
            : "";
32
        
33 1
        return parent::getSQL() . $returning;
34
    }
35
}
36