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

DbCreate::toArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 12
ccs 3
cts 3
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 0
crap 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\RethinkInterface;
9
use TBolier\RethinkQL\Types\Term\TermType;
10
11
class DbCreate extends AbstractQuery
12
{
13
    /**
14
     * @var string
15
     */
16
    private $name;
17
18
    /**
19
     * @param RethinkInterface $rethink
20
     * @param MessageInterface $message
21
     * @param string $name
22
     */
23 12
    public function __construct(RethinkInterface $rethink, MessageInterface $message, string $name)
24
    {
25 12
        parent::__construct($rethink, $message);
26
27 12
        $this->rethink = $rethink;
28 12
        $this->message = $message;
29 12
        $this->name = $name;
30 12
    }
31
32
    /**
33
     * @inheritdoc
34
     */
35 12
    public function toArray(): array
36
    {
37
        return [
38 12
            TermType::DB_CREATE,
39
            [
40
                [
41
                    TermType::DATUM,
42 12
                    $this->name,
43
                ],
44
            ],
45
        ];
46
    }
47
}
48