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

WhereMethod::cloneWith()

Size

Total Lines 1

Duplication

Lines 1
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 1
loc 1
ccs 0
cts 0
cp 0
nc 1
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