Completed
Push — master ( d789b0...e99734 )
by Jean-Christophe
03:05
created
Ajax/semantic/html/collections/menus/HtmlMenu.php 1 patch
Spacing   +19 added lines, -19 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 HtmlSemDoubleElement("item-" . $this->identifier, "div", "");
53
+			$itemO=new HtmlSemDoubleElement("item-".$this->identifier, "div", "");
54 54
 			$itemO->setContent($item);
55 55
 			$item=$itemO;
56 56
 		}
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 
60 60
 	private function afterInsert($item) {
61 61
 		if (!$item instanceof HtmlMenu)
62
-			$item->addToPropertyCtrl("class", "item", array ("item" ));
62
+			$item->addToPropertyCtrl("class", "item", array("item"));
63 63
 		else {
64 64
 			$this->setSecondary();
65 65
 		}
@@ -90,15 +90,15 @@  discard block
 block discarded – undo
90 90
 
91 91
 	public function generateMenuAsItem($menu, $header=null) {
92 92
 		$count=$this->count();
93
-		$item=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "div");
93
+		$item=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "div");
94 94
 		if (isset($header)) {
95
-			$headerItem=new HtmlSemDoubleElement("item-header-" . $this->identifier . "-" . $count, "div", "header");
95
+			$headerItem=new HtmlSemDoubleElement("item-header-".$this->identifier."-".$count, "div", "header");
96 96
 			$headerItem->setContent($header);
97 97
 			$item->addContent($headerItem);
98 98
 			$this->_itemHeader=$headerItem;
99 99
 		}
100
-		if(\is_array($menu)){
101
-			$menu=new HtmlMenu("menu-" . $this->identifier . "-" . $count,$menu);
100
+		if (\is_array($menu)) {
101
+			$menu=new HtmlMenu("menu-".$this->identifier."-".$count, $menu);
102 102
 		}
103 103
 		$menu->setClass("menu");
104 104
 		$item->addContent($menu);
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 		$value=new HtmlSemDoubleElement($identifier, "a", "browse item", $value);
114 114
 		$value->addContent(new HtmlIcon("", "dropdown"));
115 115
 		$value=$this->addItem($value);
116
-		$popup=new HtmlPopup($value, "popup-" . $this->identifier . "-" . $this->count(), $content);
116
+		$popup=new HtmlPopup($value, "popup-".$this->identifier."-".$this->count(), $content);
117 117
 		$popup->setFlowing()->setPosition("bottom left")->setOn("click");
118 118
 		$this->wrap("", $popup);
119 119
 		return $popup;
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	public function addDropdownAsItem($value, $items=NULL) {
123 123
 		$dd=$value;
124 124
 		if (\is_string($value)) {
125
-			$dd=new HtmlDropdown("dropdown-" . $this->identifier . "-" . $this->count(), $value, $items);
125
+			$dd=new HtmlDropdown("dropdown-".$this->identifier."-".$this->count(), $value, $items);
126 126
 		}
127 127
 		return $this->addItem($dd);
128 128
 	}
@@ -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 HtmlLink($this->identifier."item" . \sizeof($this->content), "", $value);
137
+		$itemO=new HtmlLink($this->identifier."item".\sizeof($this->content), "", $value);
138 138
 		return $itemO->setClass("item");
139 139
 	}
140 140
 
@@ -147,28 +147,28 @@  discard block
 block discarded – undo
147 147
 	}
148 148
 
149 149
 	public function setVertical() {
150
-		return $this->addToPropertyCtrl("class", "vertical", array ("vertical" ));
150
+		return $this->addToPropertyCtrl("class", "vertical", array("vertical"));
151 151
 	}
152 152
 
153 153
 	public function setPosition($value="right") {
154
-		return $this->addToPropertyCtrl("class", $value, array ("right","left" ));
154
+		return $this->addToPropertyCtrl("class", $value, array("right", "left"));
155 155
 	}
156 156
 
157 157
 	public function setPointing($value=Direction::NONE) {
158
-		return $this->addToPropertyCtrl("class", $value . " pointing", Direction::getConstantValues("pointing"));
158
+		return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing"));
159 159
 	}
160 160
 
161 161
 	public function asTab($vertical=false) {
162
-		$this->apply(function (HtmlDoubleElement &$item) {
162
+		$this->apply(function(HtmlDoubleElement&$item) {
163 163
 			$item->setTagName("a");
164 164
 		});
165
-		if ($vertical === true)
165
+		if ($vertical===true)
166 166
 			$this->setVertical();
167 167
 		return $this->addToProperty("class", "tabular");
168 168
 	}
169 169
 
170 170
 	public function asPagination() {
171
-		$this->apply(function (HtmlDoubleElement &$item) {
171
+		$this->apply(function(HtmlDoubleElement&$item) {
172 172
 			$item->setTagName("a");
173 173
 		});
174 174
 		return $this->addToProperty("class", "pagination");
@@ -205,10 +205,10 @@  discard block
 block discarded – undo
205 205
 	 */
206 206
 	public function setWidth($width) {
207 207
 		if (\is_int($width)) {
208
-			$width=Wide::getConstants()["W" . $width];
208
+			$width=Wide::getConstants()["W".$width];
209 209
 		}
210 210
 		$this->addToPropertyCtrl("class", $width, Wide::getConstants());
211
-		return $this->addToPropertyCtrl("class", "item", array ("item" ));
211
+		return $this->addToPropertyCtrl("class", "item", array("item"));
212 212
 	}
213 213
 
214 214
 	public function addImage($identifier, $src="", $alt="") {
Please login to merge, or discard this patch.
Ajax/semantic/html/base/traits/BaseTrait.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -8,8 +8,8 @@  discard block
 block discarded – undo
8 8
 use Ajax\semantic\html\elements\HtmlIcon;
9 9
 
10 10
 trait BaseTrait {
11
-	protected $_variations=[ ];
12
-	protected $_states=[ ];
11
+	protected $_variations=[];
12
+	protected $_states=[];
13 13
 	protected $_baseClass;
14 14
 
15 15
 	protected abstract function setPropertyCtrl($name, $value, $typeCtrl);
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 		$this->setProperty("class", $this->_baseClass);
38 38
 		if (\is_string($variations))
39 39
 			$variations=\explode(" ", $variations);
40
-		foreach ( $variations as $variation ) {
40
+		foreach ($variations as $variation) {
41 41
 			$this->addVariation($variation);
42 42
 		}
43 43
 		return $this;
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	public function addVariations($variations=array()) {
52 52
 		if (\is_string($variations))
53 53
 			$variations=\explode(" ", $variations);
54
-		foreach ( $variations as $variation ) {
54
+		foreach ($variations as $variation) {
55 55
 			$this->addVariation($variation);
56 56
 		}
57 57
 		return $this;
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	public function addStates($states=array()) {
61 61
 		if (\is_string($states))
62 62
 			$states=\explode(" ", $states);
63
-		foreach ( $states as $state ) {
63
+		foreach ($states as $state) {
64 64
 			$this->addState($state);
65 65
 		}
66 66
 		return $this;
@@ -70,14 +70,14 @@  discard block
 block discarded – undo
70 70
 		$this->setProperty("class", $this->_baseClass);
71 71
 		if (\is_string($states))
72 72
 			$states=\explode(" ", $states);
73
-		foreach ( $states as $state ) {
73
+		foreach ($states as $state) {
74 74
 			$this->addState($state);
75 75
 		}
76 76
 		return $this;
77 77
 	}
78 78
 
79 79
 	public function addIcon($icon, $before=true) {
80
-		return $this->addContent(new HtmlIcon("icon-" . $this->identifier, $icon), $before);
80
+		return $this->addContent(new HtmlIcon("icon-".$this->identifier, $icon), $before);
81 81
 	}
82 82
 
83 83
 	/**
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	 *
120 120
 	 * @return \Ajax\semantic\html\base\HtmlSemDoubleElement
121 121
 	 */
122
-	public function asHeader(){
122
+	public function asHeader() {
123 123
 		return $this->addToProperty("class", "header");
124 124
 	}
125 125
 
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	 * show it is currently the active user selection
128 128
 	 * @return \Ajax\semantic\html\base\HtmlSemDoubleElement
129 129
 	 */
130
-	public function setActive($value=true){
130
+	public function setActive($value=true) {
131 131
 		return $this->addToProperty("class", "active");
132 132
 	}
133 133
 
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	}
144 144
 
145 145
 	public function setFloated($direction="right") {
146
-		return $this->addToPropertyCtrl("class", $direction . " floated", Direction::getConstantValues("floated"));
146
+		return $this->addToPropertyCtrl("class", $direction." floated", Direction::getConstantValues("floated"));
147 147
 	}
148 148
 
149 149
 	public function floatRight() {
Please login to merge, or discard this patch.