Completed
Push — master ( 2affe6...aa2804 )
by Jean-Christophe
03:17
created
Ajax/common/html/HtmlCollection.php 2 patches
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -87,6 +87,9 @@  discard block
 block discarded – undo
87 87
 		$this->addItem($function($object));
88 88
 	}
89 89
 
90
+	/**
91
+	 * @param \Closure $callBack
92
+	 */
90 93
 	public function apply($callBack){
91 94
 		foreach ($this->content as $item){
92 95
 			$callBack($item);
@@ -102,7 +105,7 @@  discard block
 block discarded – undo
102 105
 	}
103 106
 	/**
104 107
 	 * The item factory
105
-	 * @param string|HtmlDoubleElement $value
108
+	 * @param string $value
106 109
 	 */
107 110
 	protected abstract function createItem($value);
108 111
 
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -13,29 +13,29 @@  discard block
 block discarded – undo
13 13
  */
14 14
 abstract class HtmlCollection extends HtmlDoubleElement {
15 15
 
16
-	public function __construct($identifier,$tagName="div"){
17
-		parent::__construct($identifier,$tagName);
16
+	public function __construct($identifier, $tagName="div") {
17
+		parent::__construct($identifier, $tagName);
18 18
 		$this->content=array();
19 19
 	}
20 20
 
21
-	public function addItems($items){
22
-		if(JArray::isAssociative($items)){
23
-			foreach ($items as $k=>$v){
24
-				$this->addItem([$k,$v]);
21
+	public function addItems($items) {
22
+		if (JArray::isAssociative($items)) {
23
+			foreach ($items as $k=>$v) {
24
+				$this->addItem([$k, $v]);
25 25
 			}
26
-		}else{
27
-			foreach ($items as $item){
26
+		}else {
27
+			foreach ($items as $item) {
28 28
 				$this->addItem($item);
29 29
 			}
30 30
 		}
31 31
 	}
32 32
 
33
-	public function setItems($items){
33
+	public function setItems($items) {
34 34
 		$this->content=$items;
35 35
 		return $this;
36 36
 	}
37 37
 
38
-	public function getItems(){
38
+	public function getItems() {
39 39
 		return $this->content;
40 40
 	}
41 41
 
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
 	 * @param HtmlDoubleElement|string $item
45 45
 	 * @return \Ajax\common\html\HtmlDoubleElement
46 46
 	 */
47
-	public function addItem($item){
47
+	public function addItem($item) {
48 48
 		$itemO=$item;
49
-		if(\is_object($item)===false){
49
+		if (\is_object($item)===false) {
50 50
 			$itemO=$this->createItem($item);
51 51
 		}
52 52
 		$this->addContent($itemO);
@@ -72,11 +72,11 @@  discard block
 block discarded – undo
72 72
 		return $this;
73 73
 	}
74 74
 
75
-	public function removeItem($index){
75
+	public function removeItem($index) {
76 76
 		return array_splice($this->content, $index, 1);
77 77
 	}
78 78
 
79
-	public function count(){
79
+	public function count() {
80 80
 		return \sizeof($this->content);
81 81
 	}
82 82
 
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 		$this->addItem($function($object));
88 88
 	}
89 89
 
90
-	public function apply($callBack){
91
-		foreach ($this->content as $item){
90
+	public function apply($callBack) {
91
+		foreach ($this->content as $item) {
92 92
 			$callBack($item);
93 93
 		}
94 94
 	}
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	protected abstract function createItem($value);
108 108
 
109 109
 	public function run(JsUtils $js) {
110
-		foreach ( $this->content as $content ) {
110
+		foreach ($this->content as $content) {
111 111
 			$content->run($js);
112 112
 		}
113 113
 		parent::run($js);
Please login to merge, or discard this patch.
Ajax/Semantic.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	 * @param string $identifier
74 74
 	 * @param string $icon
75 75
 	 */
76
-	public function htmlIcon($identifier,$icon){
76
+	public function htmlIcon($identifier, $icon) {
77 77
 		return $this->addHtmlComponent(new HtmlIcon($identifier, $icon));
78 78
 	}
79 79
 
@@ -82,14 +82,14 @@  discard block
 block discarded – undo
82 82
 	 * @param string $size
83 83
 	 * @param array $icons
84 84
 	 */
85
-	public function htmlIconGroups($identifier,$size="",$icons=array()){
86
-		$group=new HtmlIconGroups($identifier,$size);
87
-		if(JArray::isAssociative($icons)){
88
-			foreach ($icons as $icon=>$size){
89
-				$group->add($icon,$size);
85
+	public function htmlIconGroups($identifier, $size="", $icons=array()) {
86
+		$group=new HtmlIconGroups($identifier, $size);
87
+		if (JArray::isAssociative($icons)) {
88
+			foreach ($icons as $icon=>$size) {
89
+				$group->add($icon, $size);
90 90
 			}
91
-		}else{
92
-			foreach ($icons as $icon){
91
+		}else {
92
+			foreach ($icons as $icon) {
93 93
 				$group->add($icon);
94 94
 			}
95 95
 		}
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
 	 * @param array $elements
102 102
 	 * @param boolean $asIcons
103 103
 	 */
104
-	public function htmlButtonGroups($identifier,$elements=array(),$asIcons=false){
105
-		return $this->addHtmlComponent(new HtmlButtonGroups($identifier, $elements,$asIcons));
104
+	public function htmlButtonGroups($identifier, $elements=array(), $asIcons=false) {
105
+		return $this->addHtmlComponent(new HtmlButtonGroups($identifier, $elements, $asIcons));
106 106
 	}
107 107
 
108 108
 	/**
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	 * @param string $identifier
111 111
 	 * @param string $content
112 112
 	 */
113
-	public function htmlContainer($identifier,$content=""){
113
+	public function htmlContainer($identifier, $content="") {
114 114
 		return $this->addHtmlComponent(new HtmlContainer($identifier, $content));
115 115
 	}
116 116
 
@@ -118,8 +118,8 @@  discard block
 block discarded – undo
118 118
 	 * @param string $identifier
119 119
 	 * @param string $content
120 120
 	 */
121
-	public function htmlDivider($identifier,$content="",$tagName="div"){
122
-		return $this->addHtmlComponent(new HtmlDivider($identifier, $content,$tagName));
121
+	public function htmlDivider($identifier, $content="", $tagName="div") {
122
+		return $this->addHtmlComponent(new HtmlDivider($identifier, $content, $tagName));
123 123
 	}
124 124
 
125 125
 	/**
@@ -127,32 +127,32 @@  discard block
 block discarded – undo
127 127
 	 * @param string $content
128 128
 	 * @param string $tagName
129 129
 	 */
130
-	public function htmlLabel($identifier,$content="",$tagName="div"){
131
-		return $this->addHtmlComponent(new HtmlLabel($identifier, $content,$tagName));
130
+	public function htmlLabel($identifier, $content="", $tagName="div") {
131
+		return $this->addHtmlComponent(new HtmlLabel($identifier, $content, $tagName));
132 132
 	}
133 133
 
134 134
 	/**
135 135
 	 * @param string $identifier
136 136
 	 * @param array $items
137 137
 	 */
138
-	public function htmlMenu($identifier,$items=array()){
139
-		return $this->addHtmlComponent(new HtmlMenu($identifier,$items));
138
+	public function htmlMenu($identifier, $items=array()) {
139
+		return $this->addHtmlComponent(new HtmlMenu($identifier, $items));
140 140
 	}
141 141
 
142 142
 	/**Adds an icon menu
143 143
 	 * @param string $identifier
144 144
 	 * @param array $items icons
145 145
 	 */
146
-	public function htmlIconMenu($identifier,$items=array()){
147
-		return $this->addHtmlComponent(new HtmlIconMenu($identifier,$items));
146
+	public function htmlIconMenu($identifier, $items=array()) {
147
+		return $this->addHtmlComponent(new HtmlIconMenu($identifier, $items));
148 148
 	}
149 149
 
150 150
 	/**Adds an labeled icon menu
151 151
 	 * @param string $identifier
152 152
 	 * @param array $items icons
153 153
 	 */
154
-	public function htmlLabeledIconMenu($identifier,$items=array()){
155
-		return $this->addHtmlComponent(new HtmlLabeledIconMenu($identifier,$items));
154
+	public function htmlLabeledIconMenu($identifier, $items=array()) {
155
+		return $this->addHtmlComponent(new HtmlLabeledIconMenu($identifier, $items));
156 156
 	}
157 157
 
158 158
 	/**
@@ -160,8 +160,8 @@  discard block
 block discarded – undo
160 160
 	 * @param string $value
161 161
 	 * @param array $items
162 162
 	 */
163
-	public function htmlDropdown($identifier, $value="", $items=array()){
164
-		return $this->addHtmlComponent(new HtmlDropdown($identifier,$value,$items));
163
+	public function htmlDropdown($identifier, $value="", $items=array()) {
164
+		return $this->addHtmlComponent(new HtmlDropdown($identifier, $value, $items));
165 165
 	}
166 166
 
167 167
 	/**
@@ -169,8 +169,8 @@  discard block
 block discarded – undo
169 169
 	 * @param string $identifier
170 170
 	 * @param string $content
171 171
 	 */
172
-	public function htmlMessage($identifier, $content=""){
173
-		return $this->addHtmlComponent(new HtmlMessage($identifier,$content));
172
+	public function htmlMessage($identifier, $content="") {
173
+		return $this->addHtmlComponent(new HtmlMessage($identifier, $content));
174 174
 	}
175 175
 
176 176
 	/**
@@ -178,8 +178,8 @@  discard block
 block discarded – undo
178 178
 	 * @param string $identifier
179 179
 	 * @param string $content
180 180
 	 */
181
-	public function htmlSegment($identifier, $content=""){
182
-		return $this->addHtmlComponent(new HtmlSegment($identifier,$content));
181
+	public function htmlSegment($identifier, $content="") {
182
+		return $this->addHtmlComponent(new HtmlSegment($identifier, $content));
183 183
 	}
184 184
 
185 185
 	/**
@@ -187,16 +187,16 @@  discard block
 block discarded – undo
187 187
 	 * @param string $identifier
188 188
 	 * @param array $items the segments
189 189
 	 */
190
-	public function htmlSegmentGroups($identifier, $items=array()){
191
-		return $this->addHtmlComponent(new HtmlSegmentGroups($identifier,$items));
190
+	public function htmlSegmentGroups($identifier, $items=array()) {
191
+		return $this->addHtmlComponent(new HtmlSegmentGroups($identifier, $items));
192 192
 	}
193 193
 
194 194
 	/**
195 195
 	 * @param string $identifier
196 196
 	 * @param mixed $content
197 197
 	 */
198
-	public function htmlPopup(BaseHtml $container,$identifier,$content){
199
-		return $this->addHtmlComponent(new HtmlPopup($container,$identifier,$content));
198
+	public function htmlPopup(BaseHtml $container, $identifier, $content) {
199
+		return $this->addHtmlComponent(new HtmlPopup($container, $identifier, $content));
200 200
 	}
201 201
 
202 202
 	/**
@@ -206,8 +206,8 @@  discard block
 block discarded – undo
206 206
 	 * @param boolean $createCols
207 207
 	 * @param boolean $implicitRows
208 208
 	 */
209
-	public function htmlGrid($identifier,$numRows=1,$numCols=NULL,$createCols=true,$implicitRows=false){
210
-		return $this->addHtmlComponent(new HtmlGrid($identifier,$numRows,$numCols,$createCols,$implicitRows));
209
+	public function htmlGrid($identifier, $numRows=1, $numCols=NULL, $createCols=true, $implicitRows=false) {
210
+		return $this->addHtmlComponent(new HtmlGrid($identifier, $numRows, $numCols, $createCols, $implicitRows));
211 211
 	}
212 212
 
213 213
 	/**
@@ -216,15 +216,15 @@  discard block
 block discarded – undo
216 216
 	 * @param mixed $content
217 217
 	 * @param string $type
218 218
 	 */
219
-	public function htmlHeader($identifier,$niveau=1,$content=NULL,$type="page"){
220
-		return $this->addHtmlComponent(new HtmlHeader($identifier,$niveau,$content,$type));
219
+	public function htmlHeader($identifier, $niveau=1, $content=NULL, $type="page") {
220
+		return $this->addHtmlComponent(new HtmlHeader($identifier, $niveau, $content, $type));
221 221
 	}
222 222
 
223
-	public function htmlInput($identifier,$type="text",$value="",$placeholder=""){
224
-		return $this->addHtmlComponent(new HtmlInput($identifier,$type,$value,$placeholder));
223
+	public function htmlInput($identifier, $type="text", $value="", $placeholder="") {
224
+		return $this->addHtmlComponent(new HtmlInput($identifier, $type, $value, $placeholder));
225 225
 	}
226 226
 
227
-	public function htmlList($identifier,$items=array()){
228
-		return $this->addHtmlComponent(new HtmlList($identifier,$items));
227
+	public function htmlList($identifier, $items=array()) {
228
+		return $this->addHtmlComponent(new HtmlList($identifier, $items));
229 229
 	}
230 230
 }
231 231
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/semantic/html/content/HtmlListItem.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -7,15 +7,15 @@
 block discarded – undo
7 7
 
8 8
 class HtmlListItem extends HtmlSemDoubleElement {
9 9
 	protected $image;
10
-	public function __construct($identifier,$content) {
10
+	public function __construct($identifier, $content) {
11 11
 		parent::__construct($identifier, "div", "item");
12 12
 		$this->_template='<%tagName% id="%identifier%" %properties%>%image%%content%</%tagName%>';
13 13
 		$this->content=$content;
14 14
 	}
15
-	public function addIcon($icon){
15
+	public function addIcon($icon) {
16 16
 		$content=$this->content;
17
-		$this->content=new HtmlSemDoubleElement("content-".$this->identifier,"div","content");
17
+		$this->content=new HtmlSemDoubleElement("content-".$this->identifier, "div", "content");
18 18
 		$this->content->setContent($content);
19
-		$this->content->addContent(new HtmlIcon("icon".$this->identifier, $icon),true);
19
+		$this->content->addContent(new HtmlIcon("icon".$this->identifier, $icon), true);
20 20
 	}
21 21
 }
22 22
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/semantic/html/base/constants/Variation.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,5 +5,5 @@
 block discarded – undo
5 5
 use Ajax\common\BaseEnum;
6 6
 
7 7
 abstract class Variation extends BaseEnum {
8
-	const ANIMATED="animated",AVATAR="avatar",COMPACT="compact",FLUID="fluid",INVERTED="inverted",PADDED="padded",TRANSPARENT="transparent";
8
+	const ANIMATED="animated", AVATAR="avatar", COMPACT="compact", FLUID="fluid", INVERTED="inverted", PADDED="padded", TRANSPARENT="transparent";
9 9
 }
10 10
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/semantic/html/elements/HtmlInput.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -7,30 +7,30 @@  discard block
 block discarded – undo
7 7
 use Ajax\semantic\html\base\constants\Direction;
8 8
 use Ajax\semantic\html\base\constants\Variation;
9 9
 
10
-class HtmlInput extends HtmlSemDoubleElement{
10
+class HtmlInput extends HtmlSemDoubleElement {
11 11
 	private $_hasIcon=false;
12 12
 
13
-	public function __construct($identifier,$type="text",$value="",$placeholder=""){
14
-		parent::__construct("div-".$identifier,"div","ui input");
15
-		$this->content=new \Ajax\common\html\html5\HtmlInput($identifier,$type,$value,$placeholder);
16
-		$this->_states=[State::DISABLED,State::FOCUS,State::ERROR];
13
+	public function __construct($identifier, $type="text", $value="", $placeholder="") {
14
+		parent::__construct("div-".$identifier, "div", "ui input");
15
+		$this->content=new \Ajax\common\html\html5\HtmlInput($identifier, $type, $value, $placeholder);
16
+		$this->_states=[State::DISABLED, State::FOCUS, State::ERROR];
17 17
 		$this->_variations=[Variation::TRANSPARENT];
18 18
 	}
19 19
 
20
-	public function setFocus(){
20
+	public function setFocus() {
21 21
 		$this->addToProperty("class", State::FOCUS);
22 22
 	}
23 23
 
24
-	public function addIcon($icon,$direction=Direction::LEFT){
25
-		if($this->_hasIcon===false){
24
+	public function addIcon($icon, $direction=Direction::LEFT) {
25
+		if ($this->_hasIcon===false) {
26 26
 			$iconO=$icon;
27
-			if(\is_string($icon)){
27
+			if (\is_string($icon)) {
28 28
 				$iconO=new HtmlIcon("icon-".$this->identifier, $icon);
29 29
 			}
30 30
 			$this->addToPropertyCtrl("class", $direction." icon", Direction::getConstantValues("icon"));
31
-			$this->addContent($iconO,false);
31
+			$this->addContent($iconO, false);
32 32
 			$this->_hasIcon=true;
33
-		}else{
33
+		}else {
34 34
 			$iconO=$this->getIcon();
35 35
 			$iconO->setIcon($icon);
36 36
 			$this->addToPropertyCtrl("class", $direction." icon", Direction::getConstantValues("icon"));
@@ -38,49 +38,49 @@  discard block
 block discarded – undo
38 38
 		return $iconO;
39 39
 	}
40 40
 
41
-	public function getIcon(){
42
-		if(\is_array($this->content)){
43
-			foreach ($this->content as $item){
44
-				if($item instanceof HtmlIcon)
41
+	public function getIcon() {
42
+		if (\is_array($this->content)) {
43
+			foreach ($this->content as $item) {
44
+				if ($item instanceof HtmlIcon)
45 45
 					return $item;
46 46
 			}
47 47
 		}
48 48
 	}
49 49
 
50
-	public function addLoading(){
51
-		if($this->_hasIcon===false){
50
+	public function addLoading() {
51
+		if ($this->_hasIcon===false) {
52 52
 			throw new \Exception("Input must have an icon for showing a loader, use addIcon before");
53 53
 		}
54 54
 		return $this->addToProperty("class", State::LOADING);
55 55
 	}
56 56
 
57
-	public function addLabel($label,$direction=Direction::LEFT,$icon=NULL){
57
+	public function addLabel($label, $direction=Direction::LEFT, $icon=NULL) {
58 58
 		$labelO=$label;
59
-		if(\is_object($label)===false){
60
-			$labelO=new HtmlLabel("label-".$this->identifier,$label);
61
-			if(isset($icon))
59
+		if (\is_object($label)===false) {
60
+			$labelO=new HtmlLabel("label-".$this->identifier, $label);
61
+			if (isset($icon))
62 62
 				$labelO->addIcon($icon);
63
-		}else{
63
+		}else {
64 64
 			$labelO->addToPropertyCtrl("class", "label", array("label"));
65 65
 		}
66 66
 		$this->addToProperty("class", $direction." labeled");
67
-		$this->addContent($labelO,\strstr($direction,Direction::LEFT)!==false);
67
+		$this->addContent($labelO, \strstr($direction, Direction::LEFT)!==false);
68 68
 		return $labelO;
69 69
 	}
70 70
 
71
-	public function addLabelToCorner($label,$direction=Direction::LEFT,$icon=NULL){
72
-		return $this->addLabel($label,$direction." corner",$icon)->toCorner($direction);
71
+	public function addLabelToCorner($label, $direction=Direction::LEFT, $icon=NULL) {
72
+		return $this->addLabel($label, $direction." corner", $icon)->toCorner($direction);
73 73
 	}
74 74
 
75
-	public function addAction($action,$direction=Direction::LEFT,$icon=NULL,$labeled=false){
75
+	public function addAction($action, $direction=Direction::LEFT, $icon=NULL, $labeled=false) {
76 76
 		$actionO=$action;
77
-		if(\is_object($action)===false){
78
-			$actionO=new HtmlButton("action-".$this->identifier,$action);
79
-			if(isset($icon))
80
-				$actionO->addIcon($icon,true,$labeled);
77
+		if (\is_object($action)===false) {
78
+			$actionO=new HtmlButton("action-".$this->identifier, $action);
79
+			if (isset($icon))
80
+				$actionO->addIcon($icon, true, $labeled);
81 81
 		}
82 82
 		$this->addToProperty("class", $direction." action");
83
-		$this->addContent($actionO,\strstr($direction,Direction::LEFT)!==false);
83
+		$this->addContent($actionO, \strstr($direction, Direction::LEFT)!==false);
84 84
 		return $actionO;
85 85
 	}
86 86
 
Please login to merge, or discard this patch.
Ajax/semantic/html/elements/HtmlList.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -5,22 +5,22 @@
 block discarded – undo
5 5
 use Ajax\semantic\html\base\HtmlSemCollection;
6 6
 use Ajax\semantic\html\content\HtmlListItem;
7 7
 
8
-class HtmlList extends HtmlSemCollection{
8
+class HtmlList extends HtmlSemCollection {
9 9
 
10 10
 
11
-	public function __construct( $identifier, $items=array()){
12
-		parent::__construct( $identifier, "div", "ui list");
11
+	public function __construct($identifier, $items=array()) {
12
+		parent::__construct($identifier, "div", "ui list");
13 13
 		$this->addItems($items);
14 14
 	}
15 15
 
16 16
 
17
-	protected function createItem($value){
17
+	protected function createItem($value) {
18 18
 		$count=$this->count();
19
-		if(\is_array($value)){
19
+		if (\is_array($value)) {
20 20
 			$item=new HtmlListItem("item-".$this->identifier."-".$count, $value[0]);
21 21
 			$item->addIcon($value[1]);
22 22
 		}else
23
-			$item= new HtmlListItem("item-".$this->identifier."-".$count, $value);
23
+			$item=new HtmlListItem("item-".$this->identifier."-".$count, $value);
24 24
 		return $item;
25 25
 	}
26 26
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,8 +19,9 @@
 block discarded – undo
19 19
 		if(\is_array($value)){
20 20
 			$item=new HtmlListItem("item-".$this->identifier."-".$count, $value[0]);
21 21
 			$item->addIcon($value[1]);
22
-		}else
23
-			$item= new HtmlListItem("item-".$this->identifier."-".$count, $value);
22
+		} else {
23
+					$item= new HtmlListItem("item-".$this->identifier."-".$count, $value);
24
+		}
24 25
 		return $item;
25 26
 	}
26 27
 
Please login to merge, or discard this patch.