Passed
Pull Request — master (#18)
by Timon
08:58
created

TableCreate::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

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