MySQLUpdateQuery   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 77.78%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 18
ccs 7
cts 9
cp 0.7778
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A getSQL() 0 13 3
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\UpdateQuery;
8
9
class MySQLUpdateQuery extends UpdateQuery
10
{
11
    use Order;
12
    use Limit;
13
14 1
    public function getSQL(): string
15
    {
16 1
        $update = 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 "{$update}{$order}{$limit}";
27
    }
28
}
29