Completed
Push — master ( b4b898...f81b53 )
by Woody
11s
created

DeleteQuery   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 42.86 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 9
loc 21
ccs 8
cts 8
cp 1
c 0
b 0
f 0
rs 10
wmc 2
lcom 1
cbo 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A asExpression() 9 9 1
A startExpression() 0 4 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
declare(strict_types=1);
3
4
namespace Latitude\QueryBuilder\Query;
5
6
use Latitude\QueryBuilder\ExpressionInterface;
7
8
use function Latitude\QueryBuilder\express;
9
10
class DeleteQuery extends AbstractQuery
11
{
12
    use Capability\HasFrom;
13
    use Capability\HasWhere;
14
    use Capability\HasLimit;
15
16 3 View Code Duplication
    public function asExpression(): ExpressionInterface
0 ignored issues
show
Duplication introduced by Woody Gilk
This method 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...
17
    {
18 3
        $query = $this->startExpression();
19 3
        $query = $this->applyFrom($query);
20 3
        $query = $this->applyWhere($query);
21 3
        $query = $this->applyLimit($query);
22
23 3
        return $query;
24
    }
25
26 3
    protected function startExpression(): ExpressionInterface
27
    {
28 3
        return express('DELETE');
29
    }
30
}
31