Completed
Push — master ( 353d0e...6c7828 )
by Ron
01:57
created

RunnableUpdate   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 26
loc 26
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 3 3 1
A run() 4 4 1
A prepare() 3 3 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
namespace Kir\MySQL\Builder;
3
4
use Kir\MySQL\Builder\Internal\DDLPreparable;
5
use Kir\MySQL\Builder\Traits\CreateDDLRunnable;
6
use Kir\MySQL\Databases\MySQL;
7
8 View Code Duplication
class RunnableUpdate extends Update implements DDLPreparable {
9
	use CreateDDLRunnable;
10
	
11
	/**
12
	 * @param MySQL $db
13
	 * @param array $options
14
	 */
15
	public function __construct(MySQL $db, array $options = []) {
0 ignored issues
show
Unused Code introduced by
The parameter $options is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
16
		parent::__construct($db);
17
	}
18
19
	/**
20
	 * @param array $params
21
	 * @return int
22
	 */
23
	public function run(array $params = array()) {
24
		$query = $this->__toString();
25
		return $this->db()->exec($query, $params);
26
	}
27
28
	/**
29
	 */
30
	public function prepare() {
31
		return $this->createPreparable($this->db()->prepare($this));
32
	}
33
}
34