Completed
Push — master ( 3e8704...4367a8 )
by Jean-Christophe
03:21
created

HtmlIconGroups   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 21
Duplicated Lines 38.1 %

Coupling/Cohesion

Components 2
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 2
cbo 2
dl 8
loc 21
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A addIcon() 8 8 2
A getIcon() 0 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
3
namespace Ajax\semantic\html\elements;
4
5
use Ajax\semantic\html\base\HtmlSemDoubleElement;
6
/**
7
 * Semantic Icons group component
8
 * @see http://semantic-ui.com/elements/icon.html#/definition
9
 * @author jc
10
 * @version 1.001
11
 */
12
class HtmlIconGroups extends HtmlSemDoubleElement {
13
14
	public function __construct($identifier,$size="") {
15
		parent::__construct($identifier, "i");
16
		$this->setProperty("class", "icons");
17
		$this->setSize($size);
18
	}
19
20 View Code Duplication
	public function addIcon($icon,$size=""){
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...
21
		$iconO=$icon;
22
		if(\is_string($icon)){
23
			$iconO=new HtmlIcon("icon-".$this->identifier, $icon);
24
			$iconO->setSize($size);
25
		}
26
		$this->addContent($iconO);
27
	}
28
29
	public function getIcon($index){
30
		return $this->content[$index];
31
	}
32
}