Passed
Push — master ( 0dcdad...3d3660 )
by Jean-Christophe
01:48
created
Ajax/semantic/html/modules/HtmlTab.php 2 patches
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -18,15 +18,15 @@  discard block
 block discarded – undo
18 18
  */
19 19
 class HtmlTab extends HtmlSemCollection {
20 20
 
21
-	protected $params = [];
21
+	protected $params=[];
22 22
 
23
-	protected $_activated = false;
23
+	protected $_activated=false;
24 24
 
25
-	public function __construct($identifier, $tabs = array()) {
25
+	public function __construct($identifier, $tabs=array()) {
26 26
 		parent::__construct($identifier, "div", "");
27
-		$menu = new HtmlMenu("menu" . $this->identifier);
27
+		$menu=new HtmlMenu("menu".$this->identifier);
28 28
 		$menu->asTab(false)->setAttachment(NULL, Side::TOP);
29
-		$this->content["menu"] = $menu;
29
+		$this->content["menu"]=$menu;
30 30
 		$this->addItems($tabs);
31 31
 	}
32 32
 
@@ -37,18 +37,18 @@  discard block
 block discarded – undo
37 37
 	 * @return HtmlSegment
38 38
 	 */
39 39
 	protected function createItem($value) {
40
-		$count = $this->count();
41
-		$title = $value;
42
-		$content = NULL;
40
+		$count=$this->count();
41
+		$title=$value;
42
+		$content=NULL;
43 43
 		if (\is_array($value)) {
44
-			$title = @$value[0];
45
-			$content = @$value[1];
44
+			$title=@$value[0];
45
+			$content=@$value[1];
46 46
 		}
47
-		$menuItem = $this->content["menu"]->addItem($title);
47
+		$menuItem=$this->content["menu"]->addItem($title);
48 48
 		$menuItem->addToProperty("data-tab", $menuItem->getIdentifier());
49 49
 		$menuItem->removeProperty("href");
50
-		$result = $this->createSegment($count, $content, $menuItem->getIdentifier());
51
-		$result->menuTab = $menuItem;
50
+		$result=$this->createSegment($count, $content, $menuItem->getIdentifier());
51
+		$result->menuTab=$menuItem;
52 52
 		return $result;
53 53
 	}
54 54
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	 * @return \Ajax\semantic\html\elements\HtmlSegment
61 61
 	 */
62 62
 	private function createSegment($count, $content, $datatab) {
63
-		$segment = new HtmlSegment("item-" . $this->identifier . "-" . $count, $content);
63
+		$segment=new HtmlSegment("item-".$this->identifier."-".$count, $content);
64 64
 		$segment->setAttachment(NULL, Side::BOTTOM)
65 65
 			->addToProperty("class", "tab")
66 66
 			->addToProperty("data-tab", $datatab);
@@ -77,10 +77,10 @@  discard block
 block discarded – undo
77 77
 	 * @return \Ajax\semantic\html\modules\HtmlTab
78 78
 	 */
79 79
 	public function setTabContent($index, $content) {
80
-		$menu = $this->content["menu"];
81
-		if ($index < $menu->count()) {
82
-			if (isset($this->content[$index]) === false) {
83
-				$this->content[$index] = $this->createSegment($index, $content, $menu->getItem($index)
80
+		$menu=$this->content["menu"];
81
+		if ($index<$menu->count()) {
82
+			if (isset($this->content[$index])===false) {
83
+				$this->content[$index]=$this->createSegment($index, $content, $menu->getItem($index)
84 84
 					->getIdentifier());
85 85
 			} else
86 86
 				$this->content[$index]->setContent($content);
@@ -95,8 +95,8 @@  discard block
 block discarded – undo
95 95
 	 * @return \Ajax\semantic\html\modules\HtmlTab
96 96
 	 */
97 97
 	public function setTabsContent($contents) {
98
-		$size = \sizeof($contents);
99
-		for ($i = 0; $i < $size; $i ++) {
98
+		$size=\sizeof($contents);
99
+		for ($i=0; $i<$size; $i++) {
100 100
 			$this->setTabContent($i, $contents[$i]);
101 101
 		}
102 102
 		return $this;
@@ -109,11 +109,11 @@  discard block
 block discarded – undo
109 109
 	 * @return \Ajax\semantic\html\modules\HtmlTab
110 110
 	 */
111 111
 	public function activate($index) {
112
-		$item = $this->content["menu"]->getItem($index);
113
-		if ($item != null) {
112
+		$item=$this->content["menu"]->getItem($index);
113
+		if ($item!=null) {
114 114
 			$item->setActive(true);
115 115
 			$this->content[$index]->setActive(true);
116
-			$this->_activated = true;
116
+			$this->_activated=true;
117 117
 		}
118 118
 		return $this;
119 119
 	}
@@ -147,9 +147,9 @@  discard block
 block discarded – undo
147 147
 	 * @param array $params
148 148
 	 * @return \Ajax\semantic\html\elements\HtmlSegment
149 149
 	 */
150
-	public function forwardTab($index, JsUtils $js, $title, $initialController, $controller, $action, $params = array()) {
150
+	public function forwardTab($index, JsUtils $js, $title, $initialController, $controller, $action, $params=array()) {
151 151
 		if (\array_key_exists($index, $this->content)) {
152
-			$this->content[$index] = $js->forward($initialController, $controller, $action, $params);
152
+			$this->content[$index]=$js->forward($initialController, $controller, $action, $params);
153 153
 			return $this->content[$index];
154 154
 		}
155 155
 
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
 	 *        	The parameters to pass to the view
171 171
 	 * @return \Ajax\semantic\html\elements\HtmlSegment
172 172
 	 */
173
-	public function renderViewTab($index, JsUtils $js, $title, $initialController, $viewName, $params = array()) {
173
+	public function renderViewTab($index, JsUtils $js, $title, $initialController, $viewName, $params=array()) {
174 174
 		if (\array_key_exists($index, $this->content)) {
175
-			$this->content[$index] = $js->renderContent($initialController, $viewName, $params);
175
+			$this->content[$index]=$js->renderContent($initialController, $viewName, $params);
176 176
 			return $this->content[$index];
177 177
 		}
178 178
 		return $this->addAndRenderViewTab($js, $title, $initialController, $viewName, $params);
@@ -192,10 +192,10 @@  discard block
 block discarded – undo
192 192
 	 * @param array $params
193 193
 	 * @return \Ajax\semantic\html\elements\HtmlSegment
194 194
 	 */
195
-	public function addAndForwardTab(JsUtils $js, $title, $initialController, $controller, $action, $params = array()) {
195
+	public function addAndForwardTab(JsUtils $js, $title, $initialController, $controller, $action, $params=array()) {
196 196
 		\ob_start();
197 197
 		$js->forward($initialController, $controller, $action, $params);
198
-		$content = \ob_get_clean();
198
+		$content=\ob_get_clean();
199 199
 		return $this->addTab($title, $content);
200 200
 	}
201 201
 
@@ -211,11 +211,11 @@  discard block
 block discarded – undo
211 211
 	 *        	The parameters to pass to the view
212 212
 	 * @return \Ajax\semantic\html\elements\HtmlSegment
213 213
 	 */
214
-	public function addAndRenderViewTab(JsUtils $js, $title, $initialController, $viewName, $params = array()) {
214
+	public function addAndRenderViewTab(JsUtils $js, $title, $initialController, $viewName, $params=array()) {
215 215
 		return $this->addTab($title, $js->renderContent($initialController, $viewName, $params));
216 216
 	}
217 217
 
218
-	public function setPointing($value = Direction::NONE) {
218
+	public function setPointing($value=Direction::NONE) {
219 219
 		return $this->content["menu"]->setPointing($value);
220 220
 	}
221 221
 
@@ -250,25 +250,25 @@  discard block
 block discarded – undo
250 250
 	 * @return \Ajax\semantic\html\modules\HtmlTab
251 251
 	 */
252 252
 	public function setMenu($menu) {
253
-		$contentSize = \sizeof($this->content);
254
-		for ($i = 0; $i < $contentSize; $i ++) {
255
-			if ($menu->getItem($i) !== NULL) {
253
+		$contentSize=\sizeof($this->content);
254
+		for ($i=0; $i<$contentSize; $i++) {
255
+			if ($menu->getItem($i)!==NULL) {
256 256
 				if (isset($this->content[$i])) {
257 257
 					$menu->getItem($i)->addToProperty("data-tab", $this->content[$i]->getProperty("data-tab"));
258 258
 				}
259 259
 			}
260 260
 		}
261
-		$menuSize = $menu->count();
262
-		for ($i = 0; $i < $menuSize; $i ++) {
261
+		$menuSize=$menu->count();
262
+		for ($i=0; $i<$menuSize; $i++) {
263 263
 			$menu->getItem($i)->removeProperty("href");
264
-			if (isset($this->content[$i]) === false) {
265
-				$this->content[$i] = $this->createSegment($i, "New content", $menu->getItem($i)
264
+			if (isset($this->content[$i])===false) {
265
+				$this->content[$i]=$this->createSegment($i, "New content", $menu->getItem($i)
266 266
 					->getIdentifier());
267 267
 			}
268 268
 			$menu->getItem($i)->addToProperty("data-tab", $this->content[$i]->getProperty("data-tab"));
269 269
 		}
270 270
 
271
-		$this->content["menu"] = $menu;
271
+		$this->content["menu"]=$menu;
272 272
 		return $this;
273 273
 	}
274 274
 
@@ -277,14 +277,14 @@  discard block
 block discarded – undo
277 277
 	 * @see BaseHtml::run()
278 278
 	 */
279 279
 	public function run(JsUtils $js) {
280
-		if (isset($this->_bsComponent) === false)
281
-			$this->_bsComponent = $js->semantic()->tab("#" . $this->identifier . " .item", $this->params);
280
+		if (isset($this->_bsComponent)===false)
281
+			$this->_bsComponent=$js->semantic()->tab("#".$this->identifier." .item", $this->params);
282 282
 		$this->addEventsOnRun($js);
283 283
 		return $this->_bsComponent;
284 284
 	}
285 285
 
286
-	public function compile(JsUtils $js = NULL, &$view = NULL) {
287
-		if (! $this->_activated && $this->content["menu"]->count() > 0 && \sizeof($this->content) > 1)
286
+	public function compile(JsUtils $js=NULL, &$view=NULL) {
287
+		if (!$this->_activated && $this->content["menu"]->count()>0 && \sizeof($this->content)>1)
288 288
 			$this->activate(0);
289 289
 		return parent::compile($js, $view);
290 290
 	}
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -82,8 +82,9 @@  discard block
 block discarded – undo
82 82
 			if (isset($this->content[$index]) === false) {
83 83
 				$this->content[$index] = $this->createSegment($index, $content, $menu->getItem($index)
84 84
 					->getIdentifier());
85
-			} else
86
-				$this->content[$index]->setContent($content);
85
+			} else {
86
+							$this->content[$index]->setContent($content);
87
+			}
87 88
 		}
88 89
 		return $this;
89 90
 	}
@@ -277,15 +278,17 @@  discard block
 block discarded – undo
277 278
 	 * @see BaseHtml::run()
278 279
 	 */
279 280
 	public function run(JsUtils $js) {
280
-		if (isset($this->_bsComponent) === false)
281
-			$this->_bsComponent = $js->semantic()->tab("#" . $this->identifier . " .item", $this->params);
281
+		if (isset($this->_bsComponent) === false) {
282
+					$this->_bsComponent = $js->semantic()->tab("#" . $this->identifier . " .item", $this->params);
283
+		}
282 284
 		$this->addEventsOnRun($js);
283 285
 		return $this->_bsComponent;
284 286
 	}
285 287
 
286 288
 	public function compile(JsUtils $js = NULL, &$view = NULL) {
287
-		if (! $this->_activated && $this->content["menu"]->count() > 0 && \sizeof($this->content) > 1)
288
-			$this->activate(0);
289
+		if (! $this->_activated && $this->content["menu"]->count() > 0 && \sizeof($this->content) > 1) {
290
+					$this->activate(0);
291
+		}
289 292
 		return parent::compile($js, $view);
290 293
 	}
291 294
 }
Please login to merge, or discard this patch.