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

Update::where()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
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