Completed
Push — master ( 73e21a...085edf )
by Jean-Christophe
04:37
created

HtmlStepItem::initContent()   B

Complexity

Conditions 6
Paths 17

Size

Total Lines 26
Code Lines 20

Duplication

Lines 11
Ratio 42.31 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 11
loc 26
rs 8.439
cc 6
eloc 20
nc 17
nop 1
1
<?php
2
3
namespace Ajax\semantic\html\content;
4
5
use Ajax\service\JArray;
6
use Ajax\semantic\html\base\constants\StepStatus;
7
8
class HtmlStepItem extends HtmlAbsractItem {
9
10
	public function __construct($identifier, $content) {
11
		parent::__construct($identifier,"step",$content);
12
	}
13
	protected function initContent($content){
14
		if(\is_array($content)){
15 View Code Duplication
			if(JArray::isAssociative($content)===false){
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across 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...
16
				$icon=@$content[0];
17
				$title=@$content[1];
18
				$desc=@$content[2];
19
				$status=@$content[3];
20
			}else{
21
				$icon=@$content["icon"];
22
				$title=@$content["title"];
23
				$desc=@$content["description"];
24
				$status=@$content["status"];
25
			}
26
			if(isset($icon)===true){
27
				$this->setIcon($icon);
28
			}
29
			if(isset($status)===true){
30
				$this->setStatus($status);
31
			}
32
			if(isset($title)===true){
33
				$this->setTitle($title,$desc);
34
			}
35
		}else{
36
			$this->setContent($content);
37
		}
38
	}
39
40
	public function setActive(){
41
		return $this->setStatus(StepStatus::ACTIVE);
42
	}
43
44
	public function setCompleted(){
45
		return $this->setStatus(StepStatus::COMPLETED);
46
	}
47
48
	public function setStatus($status){
49
		return $this->addToPropertyCtrl("class", $status, StepStatus::getConstants());
50
	}
51
52
	public function removeStatus(){
53
		$this->removePropertyValues("class", StepStatus::getConstants());
54
	}
55
}