Passed
Pull Request — master (#9)
by Timon
09:13
created

Options   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 28
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setDb() 0 9 1
A jsonSerialize() 0 6 1
1
<?php
2
3
namespace TBolier\RethinkQL\Query;
4
5
use TBolier\RethinkQL\Types\Term\TermType;
6
7
class Options implements OptionsInterface
8
{
9
    private $db;
10
11 13
    public function setDb(string $name): OptionsInterface
12
    {
13 13
        $this->db = [
14 13
            TermType::DB,
15 13
            [$name],
16
        ];
17
18 13
        return $this;
19
    }
20
21
    /**
22
     * Specify data which should be serialized to JSON
23
     * @link http://php.net/manual/en/jsonserializable.jsonserialize.php
24
     * @return mixed data which can be serialized by <b>json_encode</b>,
25
     * which is a value of any type other than a resource.
26
     * @since 5.4.0
27
     */
28 13
    public function jsonSerialize()
29
    {
30
        return [
31 13
            'db' => $this->db
32
        ];
33
    }
34
}
35