AbstractQuery   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 7
c 1
b 0
f 0
dl 0
loc 26
rs 10
ccs 4
cts 4
cp 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A run() 0 6 1
A __construct() 0 3 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