Skip   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 14
c 1
b 0
f 0
dl 0
loc 36
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A toArray() 0 9 1
A __construct() 0 10 1
1
<?php
2
declare(strict_types = 1);
3
4
namespace TBolier\RethinkQL\Query\Transformation;
5
6
use TBolier\RethinkQL\Query\AbstractQuery;
7
use TBolier\RethinkQL\Query\Operation\OperationTrait;
8
use TBolier\RethinkQL\Query\QueryInterface;
9
use TBolier\RethinkQL\RethinkInterface;
10
use TBolier\RethinkQL\Types\Term\TermType;
11
12
class Skip extends AbstractQuery
13
{
14
    use TransformationTrait;
15
    use OperationTrait;
16
17
    /**
18
     * @var int
19
     */
20
    private $n;
21
22
    /**
23
     * @var QueryInterface
24
     */
25
    private $query;
26
27
    public function __construct(
28
        RethinkInterface $rethink,
29
        QueryInterface $query,
30
        int $n
31
    ) {
32
        parent::__construct($rethink);
33
34
        $this->query = $query;
35
        $this->n = $n;
36
        $this->rethink = $rethink;
37
    }
38
39
    public function toArray(): array
40
    {
41
        return [
42
            TermType::SKIP,
43
            [
44
                $this->query->toArray(),
45
                [
46
                    TermType::DATUM,
47
                    $this->n,
48
                ],
49
            ],
50
        ];
51
    }
52
}
53