Completed
Push — master ( d819e3...4fe283 )
by Christopher
03:01 queued 12s
created

WhereMethod   A

Complexity

Total Complexity 21

Size/Duplication

Total Lines 29
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 83.33%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 21
c 1
b 0
f 1
lcom 1
cbo 0
dl 29
loc 29
ccs 5
cts 6
cp 0.8333
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
cloneWith() 1 1 ?
A where() 11 11 2

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
3
namespace AsyncPHP\Icicle\Database\Builder\Method;
4
5
use Aura\SqlQuery\Common\WhereInterface;
6
use LogicException;
7
8
/**
9
 * @property string $table
10
 * @property WhereInterface $query
11
 */
12 View Code Duplication
trait WhereMethod
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...
13
{
14
    /**
15
     * @param mixed $where
16
     *
17
     * @return static
18
     *
19
     * @throws LogicException
20
     */
21 1
    public function where($where)
0 ignored issues
show
Unused Code introduced by
The parameter $where is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
22
    {
23 1
        if (!isset($this->query)) {
24
            throw new LogicException("where() called before select(), update() or delete()");
25
        }
26
27 1
        $query = clone $this->query;
28 1
        call_user_func_array([$query, "where"], func_get_args());
29
30 1
        return $this->cloneWith("query", $query);
31
    }
32
33
    /**
34
     * @param string $key
35
     * @param mixed $value
36
     *
37
     * @return static
38
     */
39
    abstract protected function cloneWith($key, $value);
40
}
41