AbstractQuery::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
ccs 0
cts 0
cp 0
cc 1
nc 1
nop 1
crap 2
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