AbstractQuery::run()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 6
rs 10
ccs 4
cts 4
cp 1
cc 1
nc 1
nop 0
crap 1
1
<?php
2
declare(strict_types=1);
3
4
namespace TBolier\RethinkQL\Query;
5
6
use TBolier\RethinkQL\Message\Message;
7
use TBolier\RethinkQL\Message\MessageInterface;
8
use TBolier\RethinkQL\RethinkInterface;
9
10
abstract class AbstractQuery implements QueryInterface
11
{
12
    /**
13
     * @var MessageInterface
14
     */
15
    protected $message;
16
17
    /**
18
     * @var RethinkInterface
19
     */
20
    protected $rethink;
21
22
    public function __construct(RethinkInterface $rethink)
23
    {
24
        $this->rethink = $rethink;
25
    }
26
27 14
    public function run()
28
    {
29 14
        $message = new Message();
30 14
        $message->setQuery($this->toArray());
31 14
32
        return $this->rethink->connection()->run($message);
33
    }
34
35
    abstract public function toArray(): array;
36
}
37