Passed
Pull Request — master (#18)
by Marc
03:37
created

DbCreate   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

2 Methods

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