Options   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 10
c 1
b 0
f 0
dl 0
loc 25
rs 10
ccs 6
cts 6
cp 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A jsonSerialize() 0 8 2
A setDb() 0 8 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