IndexDrop   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 1
A toArray() 0 9 1
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\QueryInterface;
8
use TBolier\RethinkQL\RethinkInterface;
9
use TBolier\RethinkQL\Types\Term\TermType;
10
11
class IndexDrop extends AbstractQuery
12
{
13
    /**
14
     * @var string
15
     */
16
    private $name;
17
18
    /**
19
     * @var QueryInterface
20
     */
21
    private $query;
22
23
    public function __construct(
24
        RethinkInterface $rethink,
25
        QueryInterface $query,
26
        string $name
27
    ) {
28
        parent::__construct($rethink);
29
30
        $this->query = $query;
31
        $this->rethink = $rethink;
32
33
        $this->name = $name;
34
    }
35
36
    public function toArray(): array
37
    {
38
        return [
39
            TermType::INDEX_DROP,
40
            [
41
                $this->query->toArray(),
42
                [
43
                    TermType::DATUM,
44
                    $this->name,
45
                ],
46
            ],
47
        ];
48
    }
49
}
50