Completed
Push — master ( 509987...79a3d2 )
by Rasmus
02:45
created

MySQLDeleteQuery::getSQL()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 14

Duplication

Lines 14
Ratio 100 %

Code Coverage

Tests 7
CRAP Score 3.0987

Importance

Changes 0
Metric Value
dl 14
loc 14
ccs 7
cts 9
cp 0.7778
rs 9.7998
c 0
b 0
f 0
cc 3
nc 4
nop 0
crap 3.0987
1
<?php
2
3
namespace mindplay\sql\mysql;
4
5
use mindplay\sql\model\components\Limit;
6
use mindplay\sql\model\components\Order;
7
use mindplay\sql\model\query\DeleteQuery;
8
9 View Code Duplication
class MySQLDeleteQuery extends DeleteQuery
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...
10
{
11
    use Order;
12
    use Limit;
13
14 1
    public function getSQL()
15
    {
16 1
        $delete = parent::getSQL();
17
18 1
        $order = count($this->order)
19
            ? "\nORDER BY " . $this->buildOrderTerms()
20 1
            : ''; // no order terms
21
22 1
        $limit = $this->limit !== null
23
            ? "\nLIMIT {$this->limit}"
24 1
            : ''; // no limit
25
26 1
        return "{$delete}{$order}{$limit}";
27
    }
28
}
29