Passed
Pull Request — master (#18)
by Timon
02:57
created

Delete   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 34
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

2 Methods

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