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

RunnableDelete   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 4
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() 3 3 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\Internal\DDLRunnable;
6
use Kir\MySQL\Builder\Traits\CreateDDLRunnable;
7
use Kir\MySQL\Databases\MySQL;
8
9 View Code Duplication
class RunnableDelete extends Delete implements DDLPreparable {
10
	use CreateDDLRunnable;
11
	
12
	/**
13
	 * @param MySQL $db
14
	 * @param array $options
15
	 */
16
	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...
17
		parent::__construct($db);
18
	}
19
20
	/**
21
	 * @param array $params
22
	 * @return int
23
	 */
24
	public function run(array $params = array()) {
25
		return $this->prepare()->run($params);
26
	}
27
28
	/**
29
	 * @return DDLRunnable
30
	 */
31
	public function prepare() {
32
		return $this->createPreparable($this->db()->prepare($this));
33
	}
34
}
35