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

TableCreate   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A toArray() 0 8 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