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

Semantic   A

Complexity

Total Complexity 11

Size/Duplication

Total Lines 75
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 9

Importance

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

8 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A htmlButton() 0 3 1
A htmlIcon() 0 3 1
A htmlIconGroups() 0 13 4
A htmlButtonGroups() 0 3 1
A htmlContainer() 0 3 1
A htmlDivider() 0 3 1
A htmlLabel() 0 3 1
1
<?php
2
3
namespace Ajax;
4
5
use Ajax\common\BaseGui;
6
use Ajax\semantic\html\elements\HtmlButton;
7
use Ajax\semantic\html\elements\HtmlIcon;
8
use Ajax\service\JArray;
9
use Ajax\semantic\html\elements\HtmlIconGroups;
10
use Ajax\semantic\html\elements\HtmlButtonGroups;
11
use Ajax\semantic\html\elements\HtmlContainer;
12
use Ajax\semantic\html\elements\HtmlDivider;
13
use Ajax\semantic\html\elements\HtmlLabel;
14
15
class Semantic extends BaseGui {
16
17
	public function __construct($autoCompile=true) {
18
		parent::__construct($autoCompile=true);
19
	}
20
21
	/**
22
	 * Return a new Semantic Html Button
23
	 * @param string $identifier
24
	 * @param string $value
25
	 * @param string $cssStyle
26
	 * @param string $onClick
27
	 * @return HtmlButton
28
	 */
29
	public function htmlButton($identifier, $value="", $cssStyle=null, $onClick=null) {
30
		return $this->addHtmlComponent(new HtmlButton($identifier, $value, $cssStyle, $onClick));
31
	}
32
33
	/**
34
	 * @param string $identifier
35
	 * @param string $icon
36
	 */
37
	public function htmlIcon($identifier,$icon){
38
		return $this->addHtmlComponent(new HtmlIcon($identifier, $icon));
39
	}
40
41
	/**
42
	 * @param string $identifier
43
	 * @param string $size
44
	 * @param array $icons
45
	 */
46
	public function htmlIconGroups($identifier,$size="",$icons=array()){
47
		$group=new HtmlIconGroups($identifier,$size);
48
		if(JArray::isAssociative($icons)){
49
			foreach ($icons as $icon=>$size){
50
				$group->addIcon($icon,$size);
51
			}
52
		}else{
53
			foreach ($icons as $icon){
54
				$group->addIcon($icon);
55
			}
56
		}
57
		return $this->addHtmlComponent($group);
58
	}
59
60
	/**
61
	 * @param string $identifier
62
	 * @param array $elements
63
	 * @param boolean $asIcons
64
	 */
65
	public function htmlButtonGroups($identifier,$elements=array(),$asIcons=false){
66
		return $this->addHtmlComponent(new HtmlButtonGroups($identifier, $elements,$asIcons));
67
	}
68
69
	/**
70
	 * Creates an html container
71
	 * @param string $identifier
72
	 * @param string $content
73
	 */
74
	public function htmlContainer($identifier,$content=""){
75
		return $this->addHtmlComponent(new HtmlContainer($identifier, $content));
76
	}
77
78
	/**
79
	 * @param string $identifier
80
	 * @param string $content
81
	 */
82
	public function htmlDivider($identifier,$content="",$tagName="div"){
83
		return $this->addHtmlComponent(new HtmlDivider($identifier, $content,$tagName));
84
	}
85
86
	public function htmlLabel($identifier,$content="",$tagName="div"){
87
		return $this->addHtmlComponent(new HtmlLabel($identifier, $content,$tagName));
88
	}
89
}