Passed
Push — master ( 1d8d13...de8c14 )
by Jean-Christophe
04:21
created

SemanticComponentsTrait::toast()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 2
c 1
b 0
f 1
nc 1
nop 2
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Ajax\semantic\traits;
4
5
use Ajax\common\components\GenericComponent;
6
use Ajax\semantic\components\Popup;
7
use Ajax\semantic\components\Dropdown;
8
use Ajax\semantic\components\Accordion;
9
use Ajax\common\components\SimpleComponent;
10
use Ajax\semantic\components\Sticky;
11
use Ajax\semantic\components\Checkbox;
12
use Ajax\semantic\components\Rating;
13
use Ajax\semantic\components\Progress;
14
use Ajax\semantic\components\Search;
15
use Ajax\semantic\components\Dimmer;
16
use Ajax\semantic\components\Modal;
17
use Ajax\semantic\components\Tab;
18
use Ajax\semantic\components\Shape;
19
use Ajax\semantic\components\Form;
20
use Ajax\semantic\components\SimpleSemExtComponent;
21
use Ajax\semantic\components\Toast;
22
23
/**
24
 * @author jc
25
 * @property \Ajax\JsUtils $js
26
 */
27
trait SemanticComponentsTrait {
28
29
	/**
30
	 * @param SimpleComponent $component
31
	 * @param string|null $attachTo $attachTo
32
	 * @param array|string|null $params
33
	 * @return SimpleSemExtComponent
34
	 */
35
	abstract public function addComponent(SimpleComponent $component, $attachTo, $params);
36
37
	/**
38
	 *
39
	 * @param string $attachTo
40
	 * @param string|array $params
41
	 * @return SimpleSemExtComponent
42
	 */
43
	public function generic($attachTo=NULL, $params=NULL) {
44
		return $this->addComponent(new GenericComponent($this->js), $attachTo, $params);
45
	}
46
47
	/**
48
	 *
49
	 * @param string $attachTo
50
	 * @param string|array $params
51
	 * @return Popup
52
	 */
53
	public function popup($attachTo=NULL, $params=NULL) {
54
		return $this->addComponent(new Popup($this->js), $attachTo, $params);
55
	}
56
57
	/**
58
	 *
59
	 * @param string $attachTo
60
	 * @param string|array $params
61
	 * @return Dropdown
62
	 */
63
	public function dropdown($attachTo=NULL, $params=NULL) {
64
		return $this->addComponent(new Dropdown($this->js), $attachTo, $params);
65
	}
66
67
	/**
68
	 *
69
	 * @param string $attachTo
70
	 * @param string|array $params
71
	 * @return Accordion
72
	 */
73
	public function accordion($attachTo=NULL, $params=NULL) {
74
		return $this->addComponent(new Accordion($this->js), $attachTo, $params);
75
	}
76
77
	/**
78
	 * @param string $attachTo
79
	 * @param string|array $params
80
	 * @return Sticky
81
	 */
82
	public function sticky($attachTo=NULL, $params=NULL) {
83
		return $this->addComponent(new Sticky($this->js), $attachTo, $params);
84
	}
85
86
	/**
87
	 * @param string $attachTo
88
	 * @param string|array $params
89
	 * @return Checkbox
90
	 */
91
	public function checkbox($attachTo=NULL, $params=NULL) {
92
		return $this->addComponent(new Checkbox($this->js), $attachTo, $params);
93
	}
94
95
	/**
96
	 * @param string $attachTo
97
	 * @param string|array $params
98
	 * @return Rating
99
	 */
100
	public function rating($attachTo=NULL, $params=NULL) {
101
		return $this->addComponent(new Rating($this->js), $attachTo, $params);
102
	}
103
104
	/**
105
	 * @param string $attachTo
106
	 * @param string|array $params
107
	 * @return Progress
108
	 */
109
	public function progress($attachTo=NULL, $params=NULL) {
110
		return $this->addComponent(new Progress($this->js), $attachTo, $params);
111
	}
112
113
	/**
114
	 * @param string $attachTo
115
	 * @param string|array $params
116
	 * @return Search
117
	 */
118
	public function search($attachTo=NULL, $params=NULL) {
119
		return $this->addComponent(new Search($this->js), $attachTo, $params);
120
	}
121
122
	/**
123
	 * @param string $attachTo
124
	 * @param string|array $params
125
	 * @return Dimmer
126
	 */
127
	public function dimmer($attachTo=NULL, $params=NULL) {
128
		return $this->addComponent(new Dimmer($this->js), $attachTo, $params);
129
	}
130
131
	/**
132
	 * @param string $attachTo
133
	 * @param string|array $params
134
	 * @return Modal
135
	 */
136
	public function modal($attachTo=NULL, $params=NULL,$paramsParts=NULL) {
137
		$result= $this->addComponent(new Modal($this->js), $attachTo, $params);
138
		$result->setParamParts($paramsParts);
139
		return $result;
140
	}
141
142
	/**
143
	 * @param string $attachTo
144
	 * @param string|array $params
145
	 * @return Tab
146
	 */
147
	public function tab($attachTo=NULL, $params=NULL) {
148
		$result= $this->addComponent(new Tab($this->js), $attachTo, $params);
149
		return $result;
150
	}
151
152
	/**
153
	 * @param string $attachTo
154
	 * @param string|array $params
155
	 * @return Shape
156
	 */
157
	public function shape($attachTo=NULL, $params=NULL) {
158
		$result= $this->addComponent(new Shape($this->js), $attachTo, $params);
159
		return $result;
160
	}
161
162
	/**
163
	 * @param string $attachTo
164
	 * @param string|array $params
165
	 * @return Form
166
	 */
167
	public function form($attachTo=NULL, $params=NULL) {
168
		$result= $this->addComponent(new Form($this->js), $attachTo, $params);
169
		return $result;
170
	}
171
	
172
	/**
173
	 * @param string $attachTo
174
	 * @param string|array $params
175
	 * @return Toast
176
	 */
177
	public function toast($attachTo=NULL, $params=NULL) {
178
		$result= $this->addComponent(new Toast($this->js), $attachTo, $params);
179
		return $result;
180
	}
181
182
}
183