Passed
Branch release (bd7374)
by Henry
03:48
created

Update   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A where() 0 4 1
A set() 0 4 1
A __toString() 0 3 1
1
<?php
2
3
namespace Divergence\IO\Database\Query;
4
5
class Update extends AbstractQuery
6
{
7
    public ?string $where;
8
    public ?array $set;
9 5
    public function set(array $set): Update
10
    {
11 5
        $this->set = $set;
12 5
        return $this;
13
    }
14 5
    public function where(string $where): Update
15
    {
16 5
        $this->where = $where;
17 5
        return $this;
18
    }
19
20 5
    public function __toString(): string
21
    {
22 5
        return sprintf('UPDATE `%s` SET %s WHERE %s', $this->table, join(',', $this->set), $this->where);
23
    }
24
}
25