Passed
Push — master ( 43fcfe...3bc5dd )
by Marc
06:52
created

OperationTrait::insert()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 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, /** @scrutinizer ignore-type */ $this);
14
    }
15
16
    public function filter($value)
17
    {
18
        if ($value instanceof Row) {
19
            return new FilterByRow($this->rethink, /** @scrutinizer ignore-type */ $this, $value);
20
        }
21
22
        return new Filter($this->rethink, /** @scrutinizer ignore-type */ $this, $value);
23
    }
24
25
    public function getAll(...$keys): GetAll
26
    {
27
        return new GetAll($this->rethink, /** @scrutinizer ignore-type */ $this, $keys);
28
    }
29
30
    public function update(array $elements): QueryInterface
31
    {
32
        return new Update($this->rethink, /** @scrutinizer ignore-type */ $this, $elements);
33
    }
34
35
    public function insert(array $document): QueryInterface
36
    {
37
        return new Insert($this->rethink, /** @scrutinizer ignore-type */ $this, $document);
38
    }
39
}
40