| Total Complexity | 2 |
| Total Lines | 44 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | class Update extends AbstractBuilder |
||
| 22 | { |
||
| 23 | use Traits\Set; |
||
| 24 | use Traits\Where; |
||
| 25 | use Traits\Limit; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @var string Table name |
||
| 29 | */ |
||
| 30 | protected $table; |
||
| 31 | |||
| 32 | /** |
||
| 33 | * {@inheritdoc} |
||
| 34 | */ |
||
| 35 | 1 | public function getSql(): string |
|
| 36 | { |
||
| 37 | return 'UPDATE ' |
||
| 38 | 1 | . Db::quoteIdentifier($this->table) |
|
| 39 | 1 | . $this->prepareSet() |
|
| 40 | 1 | . $this->prepareWhere() |
|
| 41 | 1 | . $this->prepareLimit(); |
|
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * Turns the query being built into a bulk update query that ranges over |
||
| 46 | * a certain table |
||
| 47 | * |
||
| 48 | * Example |
||
| 49 | * <code> |
||
| 50 | * $ub = new UpdateBuilder(); |
||
| 51 | * $ub |
||
| 52 | * ->update('users') |
||
| 53 | * ->set('password', md5('password')) |
||
| 54 | * ->where('id = ?'); |
||
| 55 | * </code> |
||
| 56 | * |
||
| 57 | * @param string $table the table whose rows are subject to the update |
||
| 58 | * |
||
| 59 | * @return Update instance |
||
| 60 | */ |
||
| 61 | 2 | public function update($table): Update |
|
| 65 | } |
||
| 66 | } |
||
| 67 |