Completed
Push — master ( 1e949f...87ce65 )
by
unknown
05:29 queued 03:21
created

Rethink::db()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
declare(strict_types=1);
3
4
namespace TBolier\RethinkQL;
5
6
use TBolier\RethinkQL\Connection\ConnectionInterface;
7
use TBolier\RethinkQL\Query\Builder;
8
use TBolier\RethinkQL\Query\BuilderInterface;
9
use TBolier\RethinkQL\Query\DatabaseInterface;
10
use TBolier\RethinkQL\Query\Message;
11
use TBolier\RethinkQL\Query\TableInterface;
12
13
class Rethink implements RethinkInterface
14
{
15
    /**
16
     * @var ConnectionInterface
17
     */
18
    private $connection;
19
20
    /**
21
     * @var BuilderInterface
22
     */
23
    private $builder;
24
25
    /**
26
     * @param ConnectionInterface $connection
27
     */
28
    public function __construct(ConnectionInterface $connection)
29
    {
30
        $this->connection = $connection;
31
        $this->builder = new Builder($this, new Message());
32
    }
33
34
    /**
35
     * @inheritdoc
36
     */
37
    public function connection(): ConnectionInterface
38
    {
39
        return $this->connection;
40
    }
41
42
    /**
43
     * @inheritdoc
44
     */
45
    public function table(string $name): TableInterface
46
    {
47
        return $this->builder->table($name);
48
    }
49
50
    /**
51
     * @inheritdoc
52
     */
53
    public function db(): DatabaseInterface
54
    {
55
        return $this->builder->database();
56
    }
57
}
58