Passed
Branch master (7cc1cf)
by Timon
22:42 queued 20:08
created

TableCreate::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\RethinkInterface;
8
use TBolier\RethinkQL\Types\Term\TermType;
9
10
class TableCreate 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(RethinkInterface $rethink, MessageInterface $message, string $name)
23
    {
24 12
        parent::__construct($rethink, $message);
25
26 12
        $this->rethink = $rethink;
27 12
        $this->message = $message;
28 12
        $this->name = $name;
29 12
    }
30
31
    /**
32
     * @inheritdoc
33
     */
34 12
    public function toArray(): array
35
    {
36
        return [
37 12
            TermType::TABLE_CREATE,
38
            [
39
                [
40
                    TermType::DATUM,
41 12
                    $this->name,
42
                ],
43
            ],
44
        ];
45
    }
46
}
47