Completed
Push — master ( b9a8b8...3e8704 )
by Jean-Christophe
03:43
created

HtmlSingleElement   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 9
c 1
b 0
f 0
lcom 1
cbo 1
dl 0
loc 45
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A setClass() 0 7 2
A setRole() 0 4 1
A setTitle() 0 4 1
A run() 0 3 1
A fromArray() 0 7 2
A setSize() 0 2 1
1
<?php
2
3
namespace Ajax\common\html;
4
5
use Ajax\JsUtils;
6
7
class HtmlSingleElement extends BaseHtml {
8
9
	public function __construct($identifier, $tagName="br") {
10
		parent::__construct($identifier);
11
		$this->tagName=$tagName;
12
		$this->_template="<%tagName% id='%identifier%' %properties%/>";
13
	}
14
15
	public function setClass($classNames) {
16
		if(is_array($classNames)){
17
			$classNames=implode(" ", $classNames);
18
		}
19
		$this->setProperty("class", $classNames);
20
		return $this;
21
	}
22
23
	public function setRole($value) {
24
		$this->setProperty("role", $value);
25
		return $this;
26
	}
27
28
	public function setTitle($value) {
29
		$this->setProperty("title", $value);
30
		return $this;
31
	}
32
33
	public function run(JsUtils $js) {
34
		// TODO Auto-generated method stub
35
	}
36
37
	/*
38
	 * (non-PHPdoc)
39
	 * @see \Ajax\bootstrap\html\BaseHtml::fromArray()
40
	 */
41
	public function fromArray($array) {
42
		$array=parent::fromArray($array);
43
		foreach ( $array as $key => $value ) {
44
			$this->setProperty($key, $value);
45
		}
46
		return $array;
47
	}
48
49
	public function setSize($size) {
50
	}
51
}