Completed
Push — master ( bb3350...c8eebb )
by Jean-Christophe
03:32
created

SemanticComponentsTrait::tab()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
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
19
trait SemanticComponentsTrait {
20
21
	public abstract function addComponent(SimpleComponent $component, $attachTo, $params);
22
23
	/**
24
	 *
25
	 * @param string $attachTo
26
	 * @param string|array $params
27
	 * @return GenericComponent
28
	 */
29
	public function generic($attachTo=NULL, $params=NULL) {
30
		return $this->addComponent(new GenericComponent($this->js), $attachTo, $params);
0 ignored issues
show
Bug introduced by
The property js does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
31
	}
32
33
	/**
34
	 *
35
	 * @param string $attachTo
36
	 * @param string|array $params
37
	 * @return Popup
38
	 */
39
	public function popup($attachTo=NULL, $params=NULL) {
40
		return $this->addComponent(new Popup($this->js), $attachTo, $params);
41
	}
42
43
	/**
44
	 *
45
	 * @param string $attachTo
46
	 * @param string|array $params
47
	 * @return Dropdown
48
	 */
49
	public function dropdown($attachTo=NULL, $params=NULL) {
50
		return $this->addComponent(new Dropdown($this->js), $attachTo, $params);
51
	}
52
53
	/**
54
	 *
55
	 * @param string $attachTo
56
	 * @param string|array $params
57
	 * @return Accordion
58
	 */
59
	public function accordion($attachTo=NULL, $params=NULL) {
60
		return $this->addComponent(new Accordion($this->js), $attachTo, $params);
61
	}
62
63
	/**
64
	 * @param string $attachTo
65
	 * @param string|array $params
66
	 * @return Sticky
67
	 */
68
	public function sticky($attachTo=NULL, $params=NULL) {
69
		return $this->addComponent(new Sticky($this->js), $attachTo, $params);
70
	}
71
72
	/**
73
	 * @param string $attachTo
74
	 * @param string|array $params
75
	 * @return Checkbox
76
	 */
77
	public function checkbox($attachTo=NULL, $params=NULL) {
78
		return $this->addComponent(new Checkbox($this->js), $attachTo, $params);
79
	}
80
81
	/**
82
	 * @param string $attachTo
83
	 * @param string|array $params
84
	 * @return Rating
85
	 */
86
	public function rating($attachTo=NULL, $params=NULL) {
87
		return $this->addComponent(new Rating($this->js), $attachTo, $params);
88
	}
89
90
	/**
91
	 * @param string $attachTo
92
	 * @param string|array $params
93
	 * @return Progress
94
	 */
95
	public function progress($attachTo=NULL, $params=NULL) {
96
		return $this->addComponent(new Progress($this->js), $attachTo, $params);
97
	}
98
99
	/**
100
	 * @param string $attachTo
101
	 * @param string|array $params
102
	 * @return Search
103
	 */
104
	public function search($attachTo=NULL, $params=NULL) {
105
		return $this->addComponent(new Search($this->js), $attachTo, $params);
106
	}
107
108
	/**
109
	 * @param string $attachTo
110
	 * @param string|array $params
111
	 * @return Dimmer
112
	 */
113
	public function dimmer($attachTo=NULL, $params=NULL) {
114
		return $this->addComponent(new Dimmer($this->js), $attachTo, $params);
115
	}
116
117
	/**
118
	 * @param string $attachTo
119
	 * @param string|array $params
120
	 * @return Modal
121
	 */
122
	public function modal($attachTo=NULL, $params=NULL,$paramsParts=NULL) {
123
		$result= $this->addComponent(new Modal($this->js), $attachTo, $params);
124
		$result->setParamParts($paramsParts);
125
		return $result;
126
	}
127
128
	/**
129
	 * @param string $attachTo
130
	 * @param string|array $params
131
	 * @return Tab
132
	 */
133
	public function tab($attachTo=NULL, $params=NULL) {
134
		$result= $this->addComponent(new Tab($this->js), $attachTo, $params);
135
		return $result;
136
	}
137
}