SemanticHtmlElementsTrait   B
last analyzed

Complexity

Total Complexity 18

Size/Duplication

Total Lines 165
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 18

Importance

Changes 0
Metric Value
wmc 18
c 0
b 0
f 0
lcom 1
cbo 18
dl 0
loc 165
rs 7.3333

19 Methods

Rating   Name   Duplication   Size   Complexity  
addHtmlComponent() 0 1 ?
A addState() 0 3 1
A htmlButton() 0 3 1
A htmlButtonGroups() 0 3 1
A htmlContainer() 0 3 1
A htmlDivider() 0 3 1
A htmlHeader() 0 3 1
A htmlIcon() 0 3 1
A htmlImage() 0 3 1
A htmlIconGroups() 0 3 1
A htmlInput() 0 3 1
A htmlLabel() 0 3 1
A htmlLabelGroups() 0 3 1
A htmlList() 0 3 1
A htmlSegment() 0 3 1
A htmlSegmentGroups() 0 3 1
A htmlReveal() 0 3 1
A htmlStep() 0 3 1
A htmlFlag() 0 3 1
1
<?php
2
3
namespace Ajax\semantic\traits;
4
5
use Ajax\semantic\html\elements\HtmlButtonGroups;
6
use Ajax\semantic\html\elements\HtmlButton;
7
use Ajax\semantic\html\elements\HtmlContainer;
8
use Ajax\semantic\html\elements\HtmlDivider;
9
use Ajax\semantic\html\elements\HtmlHeader;
10
use Ajax\semantic\html\elements\HtmlIcon;
11
use Ajax\semantic\html\elements\HtmlIconGroups;
12
use Ajax\semantic\html\elements\HtmlInput;
13
use Ajax\semantic\html\elements\HtmlLabel;
14
use Ajax\semantic\html\elements\HtmlList;
15
use Ajax\semantic\html\elements\HtmlSegment;
16
use Ajax\semantic\html\elements\HtmlSegmentGroups;
17
use Ajax\semantic\html\elements\HtmlReveal;
18
use Ajax\semantic\html\base\constants\RevealType;
19
use Ajax\semantic\html\base\constants\Direction;
20
use Ajax\semantic\html\elements\HtmlStep;
21
use Ajax\semantic\html\elements\HtmlFlag;
22
use Ajax\semantic\html\elements\HtmlImage;
23
use Ajax\semantic\html\base\constants\State;
24
use Ajax\semantic\html\elements\HtmlLabelGroups;
25
26
trait SemanticHtmlElementsTrait {
27
28
	public abstract function addHtmlComponent($htmlComponent);
29
30
	public function addState($state, $elements) {
31
		State::add($state, $elements);
32
	}
33
34
	/**
35
	 * Return a new Semantic Html Button
36
	 * @param string $identifier
37
	 * @param string $value
38
	 * @param string $cssStyle
39
	 * @param string $onClick
40
	 * @return HtmlButton
41
	 */
42
	public function htmlButton($identifier, $value="", $cssStyle=null, $onClick=null) {
43
		return $this->addHtmlComponent(new HtmlButton($identifier, $value, $cssStyle, $onClick));
44
	}
45
46
	/**
47
	 *
48
	 * @param string $identifier
49
	 * @param array $elements
50
	 * @param boolean $asIcons
51
	 * @return HtmlButtonGroups
52
	 */
53
	public function htmlButtonGroups($identifier, $elements=array(), $asIcons=false) {
54
		return $this->addHtmlComponent(new HtmlButtonGroups($identifier, $elements, $asIcons));
55
	}
56
57
	/**
58
	 * Creates an html container
59
	 * @param string $identifier
60
	 * @param string $content
61
	 * @return HtmlContainer
62
	 */
63
	public function htmlContainer($identifier, $content="") {
64
		return $this->addHtmlComponent(new HtmlContainer($identifier, $content));
65
	}
66
67
	/**
68
	 *
69
	 * @param string $identifier
70
	 * @param string $content
71
	 * @return HtmlDivider
72
	 */
73
	public function htmlDivider($identifier, $content="", $tagName="div") {
74
		return $this->addHtmlComponent(new HtmlDivider($identifier, $content, $tagName));
75
	}
76
77
	/**
78
	 *
79
	 * @param string $identifier
80
	 * @param number $niveau
81
	 * @param mixed $content
82
	 * @param string $type
83
	 * @return HtmlHeader
84
	 */
85
	public function htmlHeader($identifier, $niveau=1, $content=NULL, $type="page") {
86
		return $this->addHtmlComponent(new HtmlHeader($identifier, $niveau, $content, $type));
87
	}
88
89
	/**
90
	 *
91
	 * @param string $identifier
92
	 * @param string $icon
93
	 * @return HtmlIcon
94
	 */
95
	public function htmlIcon($identifier, $icon) {
96
		return $this->addHtmlComponent(new HtmlIcon($identifier, $icon));
97
	}
98
99
	public function htmlImage($identifier, $src="", $alt="", $size=NULL) {
100
		return $this->addHtmlComponent(new HtmlImage($identifier, $src, $alt, $size));
101
	}
102
103
	/**
104
	 *
105
	 * @param string $identifier
106
	 * @param array $icons
107
	 * @param string $size
108
	 * @return HtmlIconGroups
109
	 */
110
	public function htmlIconGroups($identifier, $icons=array(), $size="") {
111
		return $this->addHtmlComponent(new HtmlIconGroups($identifier, $icons, $size));
112
	}
113
114
	/**
115
	 *
116
	 * @param string $identifier
117
	 * @param string $type
118
	 * @param string $value
119
	 * @param string $placeholder
120
	 * @return HtmlInput
121
	 */
122
	public function htmlInput($identifier, $type="text", $value="", $placeholder="") {
123
		return $this->addHtmlComponent(new HtmlInput($identifier, $type, $value, $placeholder));
124
	}
125
126
	/**
127
	 *
128
	 * @param string $identifier
129
	 * @param string $content
130
	 * @param string $tagName
131
	 * @return HtmlLabel
132
	 */
133
	public function htmlLabel($identifier, $content="", $icon=NULL,$tagName="div") {
134
		return $this->addHtmlComponent(new HtmlLabel($identifier, $content,$icon, $tagName));
135
	}
136
137
	public function htmlLabelGroups($identifier,$labels=array(),$attributes=array()){
138
		return $this->addHtmlComponent(new HtmlLabelGroups($identifier,$labels,$attributes));
139
	}
140
141
	/**
142
	 *
143
	 * @param string $identifier
144
	 * @param array $items
145
	 * @return HtmlList
146
	 */
147
	public function htmlList($identifier, $items=array()) {
148
		return $this->addHtmlComponent(new HtmlList($identifier, $items));
149
	}
150
151
	/**
152
	 * Adds a new segment, used to create a grouping of related content
153
	 * @param string $identifier
154
	 * @param string $content
155
	 * @return HtmlSegment
156
	 */
157
	public function htmlSegment($identifier, $content="") {
158
		return $this->addHtmlComponent(new HtmlSegment($identifier, $content));
159
	}
160
161
	/**
162
	 * Adds a group of segments
163
	 * @param string $identifier
164
	 * @param array $items the segments
165
	 * @return HtmlSegmentGroups
166
	 */
167
	public function htmlSegmentGroups($identifier, $items=array()) {
168
		return $this->addHtmlComponent(new HtmlSegmentGroups($identifier, $items));
169
	}
170
171
	/**
172
	 *
173
	 * @param string $identifier
174
	 * @param string|HtmlSemDoubleElement $visibleContent
175
	 * @param string|HtmlSemDoubleElement $hiddenContent
176
	 * @param RevealType|string $type
177
	 * @param Direction|string $attributeType
178
	 */
179
	public function htmlReveal($identifier, $visibleContent, $hiddenContent, $type=RevealType::FADE, $attributeType=NULL) {
180
		return $this->addHtmlComponent(new HtmlReveal($identifier, $visibleContent, $hiddenContent, $type, $attributeType));
181
	}
182
183
	public function htmlStep($identifier, $steps=array()) {
184
		return $this->addHtmlComponent(new HtmlStep($identifier, $steps));
185
	}
186
187
	public function htmlFlag($identifier, $flag) {
188
		return $this->addHtmlComponent(new HtmlFlag($identifier, $flag));
189
	}
190
}