Code Duplication    Length = 28-28 lines in 3 locations

src/postgres/PostgresDeleteQuery.php 1 location

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

src/postgres/PostgresInsertQuery.php 1 location

@@ 13-40 (lines=28) @@
10
use mindplay\sql\model\schema\Table;
11
use mindplay\sql\model\TypeProvider;
12
13
class PostgresInsertQuery extends InsertQuery implements MapperProvider
14
{
15
    use Returning;
16
17
    /**
18
     * @param Driver       $driver
19
     * @param TypeProvider $types
20
     * @param Table        $table
21
     */
22
    public function __construct(Driver $driver, TypeProvider $types, Table $table)
23
    {
24
        parent::__construct($driver, $types, $table);
25
26
        $this->return_vars = new ReturnVars($table, $driver, $types);
27
    }
28
29
    /**
30
     * @inheritdoc
31
     */
32
    public function getSQL()
33
    {
34
        $returning = $this->return_vars->hasReturnVars()
35
            ? "\nRETURNING " . $this->return_vars->buildReturnVars()
36
            : "";
37
38
        return parent::getSQL() . $returning;
39
    }
40
}
41

src/postgres/PostgresUpdateQuery.php 1 location

@@ 13-40 (lines=28) @@
10
use mindplay\sql\model\schema\Table;
11
use mindplay\sql\model\TypeProvider;
12
13
class PostgresUpdateQuery extends UpdateQuery implements MapperProvider
14
{
15
    use Returning;
16
17
    /**
18
     * @param Driver       $driver
19
     * @param TypeProvider $types
20
     * @param Table        $table
21
     */
22
    public function __construct(Driver $driver, TypeProvider $types, Table $table)
23
    {
24
        parent::__construct($table, $driver, $types);
25
        
26
        $this->return_vars = new ReturnVars($table, $driver, $types);
27
    }
28
29
    /**
30
     * @inheritdoc
31
     */
32
    public function getSQL()
33
    {
34
        $returning = $this->return_vars->hasReturnVars()
35
            ? "\nRETURNING " . $this->return_vars->buildReturnVars()
36
            : "";
37
38
        return parent::getSQL() . $returning;
39
    }
40
}
41