Completed
Branch develop (6af1b6)
by Henry
08:27
created

Update::set()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

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