Test Failed
Pull Request — master (#66)
by Timon
02:12
created

OperationTrait   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 6
eloc 8
dl 0
loc 29
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A delete() 0 3 1
A update() 0 3 1
A getAll() 0 3 1
A filter() 0 7 2
A insert() 0 3 1
1
<?php
2
declare(strict_types = 1);
3
4
namespace TBolier\RethinkQL\Query\Operation;
5
6
use TBolier\RethinkQL\Query\Row;
7
use TBolier\RethinkQL\Query\QueryInterface;
8
9
trait OperationTrait
10
{
11
    public function delete(): QueryInterface
12
    {
13
        return new Delete($this->rethink, $this);
0 ignored issues
show
Bug introduced by
$this of type TBolier\RethinkQL\Query\Operation\OperationTrait is incompatible with the type TBolier\RethinkQL\Query\QueryInterface expected by parameter $query of TBolier\RethinkQL\Query\...n\Delete::__construct(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

13
        return new Delete($this->rethink, /** @scrutinizer ignore-type */ $this);
Loading history...
14
    }
15
16
    public function filter($value)
17
    {
18
        if ($value instanceof Row) {
19
            return new FilterByRow($this->rethink, $this, $value);
0 ignored issues
show
Bug introduced by
$this of type TBolier\RethinkQL\Query\Operation\OperationTrait is incompatible with the type TBolier\RethinkQL\Query\QueryInterface expected by parameter $query of TBolier\RethinkQL\Query\...terByRow::__construct(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

19
            return new FilterByRow($this->rethink, /** @scrutinizer ignore-type */ $this, $value);
Loading history...
20
        }
21
22
        return new Filter($this->rethink, $this, $value);
0 ignored issues
show
Bug introduced by
$this of type TBolier\RethinkQL\Query\Operation\OperationTrait is incompatible with the type TBolier\RethinkQL\Query\QueryInterface expected by parameter $query of TBolier\RethinkQL\Query\...n\Filter::__construct(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

22
        return new Filter($this->rethink, /** @scrutinizer ignore-type */ $this, $value);
Loading history...
23
    }
24
25
    public function getAll(...$keys): GetAll
26
    {
27
        return new GetAll($this->rethink, $this, $keys);
0 ignored issues
show
Bug introduced by
$this of type TBolier\RethinkQL\Query\Operation\OperationTrait is incompatible with the type TBolier\RethinkQL\Query\QueryInterface expected by parameter $query of TBolier\RethinkQL\Query\...n\GetAll::__construct(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

27
        return new GetAll($this->rethink, /** @scrutinizer ignore-type */ $this, $keys);
Loading history...
28
    }
29
30
    public function update(array $elements): QueryInterface
31
    {
32
        return new Update($this->rethink, $this, $elements);
0 ignored issues
show
Bug introduced by
$this of type TBolier\RethinkQL\Query\Operation\OperationTrait is incompatible with the type TBolier\RethinkQL\Query\QueryInterface expected by parameter $query of TBolier\RethinkQL\Query\...n\Update::__construct(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

32
        return new Update($this->rethink, /** @scrutinizer ignore-type */ $this, $elements);
Loading history...
33
    }
34
35
    public function insert(array $document): QueryInterface
36
    {
37
        return new Insert($this->rethink, $this, $document);
0 ignored issues
show
Bug introduced by
$this of type TBolier\RethinkQL\Query\Operation\OperationTrait is incompatible with the type TBolier\RethinkQL\Query\QueryInterface expected by parameter $query of TBolier\RethinkQL\Query\...n\Insert::__construct(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

37
        return new Insert($this->rethink, /** @scrutinizer ignore-type */ $this, $document);
Loading history...
38
    }
39
}
40