GetAll::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 10
rs 10
cc 1
nc 1
nop 3
1
<?php
2
declare(strict_types = 1);
3
4
namespace TBolier\RethinkQL\Query\Operation;
5
6
use TBolier\RethinkQL\Query\AbstractQuery;
7
use TBolier\RethinkQL\Query\Aggregation\AggregationTrait;
8
use TBolier\RethinkQL\Query\Manipulation\ManipulationTrait;
9
use TBolier\RethinkQL\Query\QueryInterface;
10
use TBolier\RethinkQL\Query\Transformation\TransformationTrait;
11
use TBolier\RethinkQL\RethinkInterface;
12
use TBolier\RethinkQL\Types\Term\TermType;
13
14
class GetAll extends AbstractQuery
15
{
16
    use AggregationTrait;
17
    use OperationTrait;
18
    use TransformationTrait;
19
    use ManipulationTrait;
20
21
    /**
22
     * @var array
23
     */
24
    private $keys;
25
26
    /**
27
     * @var QueryInterface
28
     */
29
    private $query;
30
31
    public function __construct(
32
        RethinkInterface $rethink,
33
        QueryInterface $query,
34
        array $keys
35
    ) {
36
        parent::__construct($rethink);
37
38
        $this->query   = $query;
39
        $this->keys    = $keys;
40
        $this->rethink = $rethink;
41
    }
42
43
    public function toArray(): array
44
    {
45
        return [
46
            TermType::GET_ALL,
47
            array_merge(
48
                [$this->query->toArray()],
49
                array_values($this->keys)
50
            ),
51
        ];
52
    }
53
}
54