Code Duplication    Length = 20-20 lines in 2 locations

src/mysql/MySQLDeleteQuery.php 1 location

@@ 9-28 (lines=20) @@
6
use mindplay\sql\model\components\Order;
7
use mindplay\sql\model\query\DeleteQuery;
8
9
class MySQLDeleteQuery extends DeleteQuery
10
{
11
    use Order;
12
    use Limit;
13
14
    public function getSQL()
15
    {
16
        $delete = parent::getSQL();
17
18
        $order = count($this->order)
19
            ? "\nORDER BY " . $this->buildOrderTerms()
20
            : ''; // no order terms
21
22
        $limit = $this->limit !== null
23
            ? "\nLIMIT {$this->limit}"
24
            : ''; // no limit
25
26
        return "{$delete}{$order}{$limit}";
27
    }
28
}
29

src/mysql/MySQLUpdateQuery.php 1 location

@@ 9-28 (lines=20) @@
6
use mindplay\sql\model\components\Order;
7
use mindplay\sql\model\query\UpdateQuery;
8
9
class MySQLUpdateQuery extends UpdateQuery
10
{
11
    use Order;
12
    use Limit;
13
14
    public function getSQL()
15
    {
16
        $update = parent::getSQL();
17
18
        $order = count($this->order)
19
            ? "\nORDER BY " . $this->buildOrderTerms()
20
            : ''; // no order terms
21
22
        $limit = $this->limit !== null
23
            ? "\nLIMIT {$this->limit}"
24
            : ''; // no limit
25
26
        return "{$update}{$order}{$limit}";
27
    }
28
}
29