Passed
Push — master ( 1fb59e...589f6e )
by Jean-Christophe
02:54
created
Ajax/semantic/html/collections/menus/HtmlMenu.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -41,12 +41,12 @@  discard block
 block discarded – undo
41 41
 	 * @return HtmlMenu
42 42
 	 */
43 43
 	public function setType($type="") {
44
-		return $this->addToPropertyCtrl("class", $type, array ("","item","text" ));
44
+		return $this->addToPropertyCtrl("class", $type, array("", "item", "text"));
45 45
 	}
46 46
 
47 47
 	public function setActiveItem($index) {
48 48
 		$item=$this->getItem($index);
49
-		if ($item !== null) {
49
+		if ($item!==null) {
50 50
 			$item->addToProperty("class", "active");
51 51
 		}
52 52
 		return $this;
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
 	private function getItemToInsert($item) {
56 56
 		if ($item instanceof HtmlInput || $item instanceof HtmlImg || $item instanceof HtmlIcon || $item instanceof HtmlButtonGroups || $item instanceof HtmlButton || $item instanceof HtmlLabel) {
57
-			$itemO=new HtmlMenuItem("item-" . $this->identifier . "-" . \sizeof($this->content) , $item);
57
+			$itemO=new HtmlMenuItem("item-".$this->identifier."-".\sizeof($this->content), $item);
58 58
 			$itemO->addClass("no-active");
59 59
 			$item=$itemO;
60 60
 		}
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 
64 64
 	private function afterInsert($item) {
65 65
 		if (!$item instanceof HtmlMenu && $item->propertyContains("class", "header")===false)
66
-			$item->addToPropertyCtrl("class", "item", array ("item" ));
66
+			$item->addToPropertyCtrl("class", "item", array("item"));
67 67
 		else {
68 68
 			$this->setSecondary();
69 69
 		}
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	public function addItem($item) {
80 80
 		$number=$item;
81 81
 		$item=parent::addItem($this->getItemToInsert($item));
82
-		if(\is_int($number))
82
+		if (\is_int($number))
83 83
 			$item->setProperty("data-page", $number);
84 84
 		return $this->afterInsert($item);
85 85
 	}
@@ -97,15 +97,15 @@  discard block
 block discarded – undo
97 97
 
98 98
 	public function generateMenuAsItem($menu, $header=null) {
99 99
 		$count=$this->count();
100
-		$item=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "div");
100
+		$item=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "div");
101 101
 		if (isset($header)) {
102
-			$headerItem=new HtmlSemDoubleElement("item-header-" . $this->identifier . "-" . $count, "div", "header");
102
+			$headerItem=new HtmlSemDoubleElement("item-header-".$this->identifier."-".$count, "div", "header");
103 103
 			$headerItem->setContent($header);
104 104
 			$item->addContent($headerItem);
105 105
 			$this->_itemHeader=$headerItem;
106 106
 		}
107
-		if(\is_array($menu)){
108
-			$menu=new HtmlMenu("menu-" . $this->identifier . "-" . $count,$menu);
107
+		if (\is_array($menu)) {
108
+			$menu=new HtmlMenu("menu-".$this->identifier."-".$count, $menu);
109 109
 		}
110 110
 		$menu->setClass("menu");
111 111
 		$item->addContent($menu);
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 		$value=new HtmlSemDoubleElement($identifier, "a", "browse item", $value);
121 121
 		$value->addContent(new HtmlIcon("", "dropdown"));
122 122
 		$value=$this->addItem($value);
123
-		$popup=new HtmlPopup($value, "popup-" . $this->identifier . "-" . $this->count(), $content);
123
+		$popup=new HtmlPopup($value, "popup-".$this->identifier."-".$this->count(), $content);
124 124
 		$popup->setFlowing()->setPosition("bottom left")->setOn("click");
125 125
 		$this->wrap("", $popup);
126 126
 		return $popup;
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 	public function addDropdownAsItem($value, $items=NULL) {
130 130
 		$dd=$value;
131 131
 		if (\is_string($value)) {
132
-			$dd=new HtmlDropdown("dropdown-" . $this->identifier . "-" . $this->count(), $value, $items);
132
+			$dd=new HtmlDropdown("dropdown-".$this->identifier."-".$this->count(), $value, $items);
133 133
 		}
134 134
 		$this->addItem($dd);
135 135
 		return $dd;
@@ -142,14 +142,14 @@  discard block
 block discarded – undo
142 142
 	 * @see HtmlCollection::createItem()
143 143
 	 */
144 144
 	protected function createItem($value) {
145
-		$itemO=new HtmlMenuItem($this->identifier."-item-" . \sizeof($this->content),"");
145
+		$itemO=new HtmlMenuItem($this->identifier."-item-".\sizeof($this->content), "");
146 146
 		$itemO->setTagName("a");
147 147
 		$itemO->setContent($value);
148 148
 		return $itemO;
149 149
 	}
150 150
 
151 151
 	public function setSecondary($value=true) {
152
-		if($value)
152
+		if ($value)
153 153
 			$this->addToProperty("class", "secondary");
154 154
 		else
155 155
 			$this->removePropertyValue("class", "secondary");
@@ -157,28 +157,28 @@  discard block
 block discarded – undo
157 157
 	}
158 158
 
159 159
 	public function setVertical() {
160
-		return $this->addToPropertyCtrl("class", "vertical", array ("vertical" ));
160
+		return $this->addToPropertyCtrl("class", "vertical", array("vertical"));
161 161
 	}
162 162
 
163 163
 	public function setPosition($value="right") {
164
-		return $this->addToPropertyCtrl("class", $value, array ("right","left" ));
164
+		return $this->addToPropertyCtrl("class", $value, array("right", "left"));
165 165
 	}
166 166
 
167 167
 	public function setPointing($value=Direction::NONE) {
168
-		return $this->addToPropertyCtrl("class", $value . " pointing", Direction::getConstantValues("pointing"));
168
+		return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing"));
169 169
 	}
170 170
 
171 171
 	public function asTab($vertical=false) {
172
-		$this->apply(function (HtmlDoubleElement &$item) {
172
+		$this->apply(function(HtmlDoubleElement &$item) {
173 173
 			$item->setTagName("a");
174 174
 		});
175
-		if ($vertical === true)
175
+		if ($vertical===true)
176 176
 			$this->setVertical();
177 177
 		return $this->addToProperty("class", "tabular");
178 178
 	}
179 179
 
180 180
 	public function asPagination() {
181
-		$this->apply(function (HtmlDoubleElement &$item) {
181
+		$this->apply(function(HtmlDoubleElement &$item) {
182 182
 			$item->setTagName("a");
183 183
 		});
184 184
 		return $this->addToProperty("class", "pagination");
@@ -215,10 +215,10 @@  discard block
 block discarded – undo
215 215
 	 */
216 216
 	public function setWidth($width) {
217 217
 		if (\is_int($width)) {
218
-			$width=Wide::getConstants()["W" . $width];
218
+			$width=Wide::getConstants()["W".$width];
219 219
 		}
220 220
 		$this->addToPropertyCtrl("class", $width, Wide::getConstants());
221
-		return $this->addToPropertyCtrl("class", "item", array ("item" ));
221
+		return $this->addToPropertyCtrl("class", "item", array("item"));
222 222
 	}
223 223
 
224 224
 	public function addImage($identifier, $src="", $alt="") {
@@ -233,14 +233,14 @@  discard block
 block discarded – undo
233 233
 		return $this->_itemHeader;
234 234
 	}
235 235
 
236
-	public function setHasContainer(){
237
-		return $this->wrapContent("<div class='ui container'>","</div>");
236
+	public function setHasContainer() {
237
+		return $this->wrapContent("<div class='ui container'>", "</div>");
238 238
 	}
239 239
 
240
-	public function run(JsUtils $js){
241
-		if($this->identifier!=="" && !isset($this->_bsComponent))
242
-			$this->onClick('if(!$(this).hasClass("dropdown")&&!$(this).hasClass("no-active")){$(this).addClass("active").siblings().removeClass("active");}',false,false);
243
-		$result= parent::run($js);
240
+	public function run(JsUtils $js) {
241
+		if ($this->identifier!=="" && !isset($this->_bsComponent))
242
+			$this->onClick('if(!$(this).hasClass("dropdown")&&!$(this).hasClass("no-active")){$(this).addClass("active").siblings().removeClass("active");}', false, false);
243
+		$result=parent::run($js);
244 244
 		return $result->setItemSelector(">.item");
245 245
 	}
246 246
 }
Please login to merge, or discard this patch.