Passed
Pull Request — master (#34)
by Marc
05:44
created

TableCreate::toArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 2
cts 2
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
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 TableCreate 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 13
     */
23
    public function __construct(RethinkInterface $rethink, MessageInterface $message, string $name)
24 13
    {
25
        parent::__construct($rethink, $message);
26 13
27 13
        $this->rethink = $rethink;
28 13
        $this->message = $message;
29 13
        $this->name = $name;
30
    }
31
32
    /**
33
     * @inheritdoc
34 13
     */
35
    public function toArray(): array
36
    {
37 13
        return [
38
            TermType::TABLE_CREATE,
39
            [
40
                [
41 13
                    TermType::DATUM,
42
                    $this->name,
43
                ],
44
            ],
45
        ];
46
    }
47
}
48