Completed
Push — master ( fcbb8e...5e827b )
by Jean-Christophe
03:17
created
Ajax/semantic/html/collections/menus/HtmlMenu.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -37,12 +37,12 @@  discard block
 block discarded – undo
37 37
 	 * @return \Ajax\semantic\html\collections\HtmlMenu
38 38
 	 */
39 39
 	public function setType($type="") {
40
-		return $this->addToPropertyCtrl("class", $type, array ("","item","text" ));
40
+		return $this->addToPropertyCtrl("class", $type, array("", "item", "text"));
41 41
 	}
42 42
 
43 43
 	public function setActiveItem($index) {
44 44
 		$item=$this->getItem($index);
45
-		if ($item !== null) {
45
+		if ($item!==null) {
46 46
 			$item->addToProperty("class", "active");
47 47
 		}
48 48
 		return $this;
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 
51 51
 	private function getItemToInsert($item) {
52 52
 		if ($item instanceof HtmlInput || $item instanceof HtmlImg || $item instanceof HtmlIcon || $item instanceof HtmlButton || ($item instanceof HtmlDropdown && $this->propertyContains("class", "vertical")===false)) {
53
-			$itemO=new HtmlMenuItem("item-" . $this->identifier . "-" . \sizeof($this->content) , $item);
53
+			$itemO=new HtmlMenuItem("item-".$this->identifier."-".\sizeof($this->content), $item);
54 54
 			$item=$itemO;
55 55
 		}
56 56
 		return $item;
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 
59 59
 	private function afterInsert($item) {
60 60
 		if (!$item instanceof HtmlMenu && $item->propertyContains("class", "header")===false)
61
-			$item->addToPropertyCtrl("class", "item", array ("item" ));
61
+			$item->addToPropertyCtrl("class", "item", array("item"));
62 62
 		else {
63 63
 			$this->setSecondary();
64 64
 		}
@@ -89,15 +89,15 @@  discard block
 block discarded – undo
89 89
 
90 90
 	public function generateMenuAsItem($menu, $header=null) {
91 91
 		$count=$this->count();
92
-		$item=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "div");
92
+		$item=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "div");
93 93
 		if (isset($header)) {
94
-			$headerItem=new HtmlSemDoubleElement("item-header-" . $this->identifier . "-" . $count, "div", "header");
94
+			$headerItem=new HtmlSemDoubleElement("item-header-".$this->identifier."-".$count, "div", "header");
95 95
 			$headerItem->setContent($header);
96 96
 			$item->addContent($headerItem);
97 97
 			$this->_itemHeader=$headerItem;
98 98
 		}
99
-		if(\is_array($menu)){
100
-			$menu=new HtmlMenu("menu-" . $this->identifier . "-" . $count,$menu);
99
+		if (\is_array($menu)) {
100
+			$menu=new HtmlMenu("menu-".$this->identifier."-".$count, $menu);
101 101
 		}
102 102
 		$menu->setClass("menu");
103 103
 		$item->addContent($menu);
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 		$value=new HtmlSemDoubleElement($identifier, "a", "browse item", $value);
113 113
 		$value->addContent(new HtmlIcon("", "dropdown"));
114 114
 		$value=$this->addItem($value);
115
-		$popup=new HtmlPopup($value, "popup-" . $this->identifier . "-" . $this->count(), $content);
115
+		$popup=new HtmlPopup($value, "popup-".$this->identifier."-".$this->count(), $content);
116 116
 		$popup->setFlowing()->setPosition("bottom left")->setOn("click");
117 117
 		$this->wrap("", $popup);
118 118
 		return $popup;
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	public function addDropdownAsItem($value, $items=NULL) {
122 122
 		$dd=$value;
123 123
 		if (\is_string($value)) {
124
-			$dd=new HtmlDropdown("dropdown-" . $this->identifier . "-" . $this->count(), $value, $items);
124
+			$dd=new HtmlDropdown("dropdown-".$this->identifier."-".$this->count(), $value, $items);
125 125
 		}
126 126
 		$this->addItem($dd);
127 127
 		return $dd;
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	 * @see \Ajax\common\html\html5\HtmlCollection::createItem()
135 135
 	 */
136 136
 	protected function createItem($value) {
137
-		$itemO=new HtmlMenuItem($this->identifier."-item-" . \sizeof($this->content),"");
137
+		$itemO=new HtmlMenuItem($this->identifier."-item-".\sizeof($this->content), "");
138 138
 		$itemO->setTagName("a");
139 139
 		$itemO->setContent($value);
140 140
 		return $itemO;
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	}
146 146
 
147 147
 	public function setSecondary($value=true) {
148
-		if($value)
148
+		if ($value)
149 149
 			$this->addToProperty("class", "secondary");
150 150
 		else
151 151
 			$this->removePropertyValue("class", "secondary");
@@ -153,28 +153,28 @@  discard block
 block discarded – undo
153 153
 	}
154 154
 
155 155
 	public function setVertical() {
156
-		return $this->addToPropertyCtrl("class", "vertical", array ("vertical" ));
156
+		return $this->addToPropertyCtrl("class", "vertical", array("vertical"));
157 157
 	}
158 158
 
159 159
 	public function setPosition($value="right") {
160
-		return $this->addToPropertyCtrl("class", $value, array ("right","left" ));
160
+		return $this->addToPropertyCtrl("class", $value, array("right", "left"));
161 161
 	}
162 162
 
163 163
 	public function setPointing($value=Direction::NONE) {
164
-		return $this->addToPropertyCtrl("class", $value . " pointing", Direction::getConstantValues("pointing"));
164
+		return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing"));
165 165
 	}
166 166
 
167 167
 	public function asTab($vertical=false) {
168
-		$this->apply(function (HtmlDoubleElement &$item) {
168
+		$this->apply(function(HtmlDoubleElement&$item) {
169 169
 			$item->setTagName("a");
170 170
 		});
171
-		if ($vertical === true)
171
+		if ($vertical===true)
172 172
 			$this->setVertical();
173 173
 		return $this->addToProperty("class", "tabular");
174 174
 	}
175 175
 
176 176
 	public function asPagination() {
177
-		$this->apply(function (HtmlDoubleElement &$item) {
177
+		$this->apply(function(HtmlDoubleElement&$item) {
178 178
 			$item->setTagName("a");
179 179
 		});
180 180
 		return $this->addToProperty("class", "pagination");
@@ -211,10 +211,10 @@  discard block
 block discarded – undo
211 211
 	 */
212 212
 	public function setWidth($width) {
213 213
 		if (\is_int($width)) {
214
-			$width=Wide::getConstants()["W" . $width];
214
+			$width=Wide::getConstants()["W".$width];
215 215
 		}
216 216
 		$this->addToPropertyCtrl("class", $width, Wide::getConstants());
217
-		return $this->addToPropertyCtrl("class", "item", array ("item" ));
217
+		return $this->addToPropertyCtrl("class", "item", array("item"));
218 218
 	}
219 219
 
220 220
 	public function addImage($identifier, $src="", $alt="") {
Please login to merge, or discard this patch.