RunnableUpdate   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 7
c 0
b 0
f 0
dl 0
loc 19
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A run() 0 3 1
A prepare() 0 4 1
1
<?php
2
namespace Kir\MySQL\Builder;
3
4
use Kir\MySQL\Builder\Internal\DDLPreparable;
5
use Kir\MySQL\Builder\Internal\DDLRunnable;
6
use Kir\MySQL\Builder\Traits\CreateDDLRunnable;
7
8
/**
9
 * @implements DDLPreparable<int>
10
 */
11
class RunnableUpdate extends Update implements DDLPreparable {
12
	/** @use CreateDDLRunnable<int> */
13
	use CreateDDLRunnable;
14
15
	/**
16
	 * @inheritDoc
17
	 */
18
	public function run(array $params = []): int {
19
		$query = $this->__toString();
20
		return $this->db()->exec($query, $params);
21
	}
22
23
	/**
24
	 * @return DDLRunnable<int>
25
	 */
26
	public function prepare(): DDLRunnable {
27
		return $this->createPreparable(
28
			$this->db()->prepare($this),
29
			fn($v) => (int) $v
30
		);
31
	}
32
}
33