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

Semantic::htmlGroupIcons()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 13
rs 9.2
cc 4
eloc 9
nc 4
nop 3
1
<?php
2
3
namespace Ajax;
4
5
use Ajax\common\BaseGui;
6
use Ajax\semantic\html\HtmlButton;
7
use Ajax\semantic\html\HtmlIcon;
8
use Ajax\semantic\html\HtmlGroupIcons;
9
use Ajax\service\JArray;
10
11
class Semantic extends BaseGui {
12
13
	public function __construct($autoCompile=true) {
14
		parent::__construct($autoCompile=true);
15
	}
16
17
	/**
18
	 * Return a new Semantic Html Button
19
	 * @param string $identifier
20
	 * @param string $value
21
	 * @param string $cssStyle
22
	 * @param string $onClick
23
	 * @return HtmlButton
24
	 */
25
	public function htmlButton($identifier, $value="", $cssStyle=null, $onClick=null) {
26
		return $this->addHtmlComponent(new HtmlButton($identifier, $value, $cssStyle, $onClick));
27
	}
28
29
	public function htmlIcon($identifier,$icon){
30
		return $this->addHtmlComponent(new HtmlIcon($identifier, $icon));
31
	}
32
33
	public function htmlGroupIcons($identifier,$size="",$icons=array()){
34
		$group=new HtmlGroupIcons($identifier,$size);
35
		if(JArray::isAssociative($icons)){
36
			foreach ($icons as $icon=>$size){
37
				$group->addIcon($icon,$size);
38
			}
39
		}else{
40
			foreach ($icons as $icon){
41
				$group->addIcon($icon);
42
			}
43
		}
44
		return $this->addHtmlComponent($group);
45
	}
46
}