Options::setDb()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 8
rs 10
ccs 3
cts 3
cp 1
cc 1
nc 1
nop 1
crap 1
1
<?php
2
declare(strict_types = 1);
3
4
namespace TBolier\RethinkQL\Query;
5
6
use TBolier\RethinkQL\Types\Term\TermType;
7
8
class Options implements OptionsInterface
9
{
10
    /**
11
     * @var array
12
     */
13
    private $db;
14
15
    public function setDb(string $name): OptionsInterface
16
    {
17
        $this->db = [
18
            TermType::DB,
19 28
            [$name],
20
        ];
21 28
22 28
        return $this;
23 28
    }
24
25
    public function jsonSerialize()
26 28
    {
27
        if (empty($this->db)) {
28
            return [];
29
        }
30
31
        return [
32 17
            'db' => $this->db
33
        ];
34 17
    }
35
}
36