Various   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 49
Duplicated Lines 32.65 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A options_section() 0 3 1
A actions_section() 16 16 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 DummyPress\Views;
3
use DummyPress\Abstracts as Abs;
4
5
/**
6
 * Generate view for other various test content action
7
 *
8
 * @abstract
9
 * @package    WordPress
10
 * @subpackage Test Content
11
 * @author     Mike Selander
12
 */
13
class Various extends Abs\View {
14
15
	public function __construct() {
16
17
		$this->title	= __( 'Various', 'dummybot' );
18
		$this->type		= 'all';
19
		$this->priority	= 10;
20
21
	}
22
23
24
	/**
25
	 * Our sections action block - button to create and delete.
26
	 *
27
	 * @access protected
28
	 *
29
	 * @return string HTML content.
30
	 */
31 View Code Duplication
	protected function actions_section() {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
32
		$html = '';
33
34
		$html .= "<div class='test-data-cpt'>";
35
36
			$html .= "<h3>";
37
38
				$html .= "<span class='label'>" . esc_html__( 'Clean Site', 'dummybot' ) . "</span>";
39
				$html .= $this->build_button( 'delete', 'all', __( 'Delete All Test Data', 'dummybot' ) );
40
41
			$html .= "</h3>";
42
43
		$html .= "</div>";
44
45
		return $html;
46
	}
47
48
49
	/**
50
	 * We don't need any options on this page, so returning it empty
51
	 *
52
	 * @access protected
53
	 *
54
	 * @param string $html Existing HTML content.
55
	 * @return string HTML section content.
56
	 */
57
	protected function options_section( $html = '' ) {
58
		return $html;
59
	}
60
61
}
62