OperationTrait   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 7
eloc 9
c 1
b 0
f 0
dl 0
loc 34
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A changes() 0 3 1
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 changes(array $options = null): Changes
12
    {
13
        return new Changes($this->rethink, /** @scrutinizer ignore-type */ $this, $options);
14
    }
15
16
    public function delete(): QueryInterface
17
    {
18
        return new Delete($this->rethink, /** @scrutinizer ignore-type */ $this);
19
    }
20
21
    public function filter($value)
22
    {
23
        if (\is_object($value)) {
24
            return new FilterByRow($this->rethink, /** @scrutinizer ignore-type */ $this, $value);
25
        }
26
27
        return new Filter($this->rethink, /** @scrutinizer ignore-type */ $this, $value);
28
    }
29
30
    public function getAll(...$keys): GetAll
31
    {
32
        return new GetAll($this->rethink, /** @scrutinizer ignore-type */ $this, $keys);
33
    }
34
35
    public function update(array $elements): QueryInterface
36
    {
37
        return new Update($this->rethink, /** @scrutinizer ignore-type */ $this, $elements);
38
    }
39
40
    public function insert(array $document): QueryInterface
41
    {
42
        return new Insert($this->rethink, /** @scrutinizer ignore-type */ $this, $document);
43
    }
44
}
45