Passed
Push — master ( e046eb...6da082 )
by Jean-Christophe
01:59
created
Ajax/semantic/html/collections/table/traits/TableTrait.php 2 patches
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -10,9 +10,9 @@  discard block
 block discarded – undo
10 10
  */
11 11
 trait TableTrait {
12 12
 
13
-	abstract public function addEvent($event, $jsCode, $stopPropagation = false, $preventDefault = false);
13
+	abstract public function addEvent($event, $jsCode, $stopPropagation=false, $preventDefault=false);
14 14
 
15
-	abstract public function getOn($event, $url, $responseElement = "", $parameters = array());
15
+	abstract public function getOn($event, $url, $responseElement="", $parameters=array());
16 16
 
17 17
 	protected function addToPropertyTable($property, $value) {
18 18
 		return $this->_self->addToProperty($property, $value);
@@ -22,8 +22,8 @@  discard block
 block discarded – undo
22 22
 		return $this->addToPropertyTable("class", "celled");
23 23
 	}
24 24
 
25
-	public function setBasic($very = false) {
26
-		$table = $this->_self;
25
+	public function setBasic($very=false) {
26
+		$table=$this->_self;
27 27
 		if ($very)
28 28
 			$table->addToPropertyCtrl("class", "very", array(
29 29
 				"very"
@@ -33,8 +33,8 @@  discard block
 block discarded – undo
33 33
 		));
34 34
 	}
35 35
 
36
-	public function setCompact($very = false) {
37
-		$table = $this->_self;
36
+	public function setCompact($very=false) {
37
+		$table=$this->_self;
38 38
 		if ($very)
39 39
 			$table->addToPropertyCtrl("class", "very", array(
40 40
 				"very"
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
 		return $this->addToPropertyTable("class", "structured");
57 57
 	}
58 58
 
59
-	public function setSortable($colIndex = NULL) {
60
-		$table = $this->_self;
59
+	public function setSortable($colIndex=NULL) {
60
+		$table=$this->_self;
61 61
 		if (isset($colIndex) && $table->hasPart("thead")) {
62 62
 			$table->getHeader()->sort($colIndex);
63 63
 		}
@@ -80,29 +80,29 @@  discard block
 block discarded – undo
80 80
 		return $this->addToPropertyTable("class", "striped");
81 81
 	}
82 82
 
83
-	public function onRowClick($jsCode, $stopPropagation = false, $preventDefault = false) {
83
+	public function onRowClick($jsCode, $stopPropagation=false, $preventDefault=false) {
84 84
 		return $this->onRow("click", $jsCode, $stopPropagation, $preventDefault);
85 85
 	}
86 86
 
87
-	public function onRow($event, $jsCode, $stopPropagation = false, $preventDefault = false) {
88
-		return $this->_self->addEvent($event . "{{tbody tr}}", $jsCode, $stopPropagation, $preventDefault);
87
+	public function onRow($event, $jsCode, $stopPropagation=false, $preventDefault=false) {
88
+		return $this->_self->addEvent($event."{{tbody tr}}", $jsCode, $stopPropagation, $preventDefault);
89 89
 	}
90 90
 
91
-	public function getOnRow($event, $url, $responseElement = "", $parameters = array()) {
92
-		$jsCondition = '!$(this).closest("tr").hasClass("active")';
91
+	public function getOnRow($event, $url, $responseElement="", $parameters=array()) {
92
+		$jsCondition='!$(this).closest("tr").hasClass("active")';
93 93
 		if (isset($parameters['jsCondition'])) {
94
-			$jsCondition = '(' . $parameters['jsCondition'] . ' && ' . $jsCondition . ')';
94
+			$jsCondition='('.$parameters['jsCondition'].' && '.$jsCondition.')';
95 95
 		}
96
-		$parameters = \array_merge($parameters, [
96
+		$parameters=\array_merge($parameters, [
97 97
 			"stopPropagation" => false,
98 98
 			"preventDefault" => false,
99 99
 			"jsCondition" => $jsCondition
100 100
 		]);
101
-		$selector = "tbody tr";
101
+		$selector="tbody tr";
102 102
 		if (isset($parameters["selector"])) {
103
-			$selector = $parameters["selector"];
103
+			$selector=$parameters["selector"];
104 104
 		}
105
-		return $this->_self->getOn($event . "{{" . $selector . "}}", $url, $responseElement, $parameters);
105
+		return $this->_self->getOn($event."{{".$selector."}}", $url, $responseElement, $parameters);
106 106
 	}
107 107
 
108 108
 	public function onPageChange($jsCode) {
@@ -119,10 +119,10 @@  discard block
 block discarded – undo
119 119
 		return $this->_self->getBsComponent()->getScript();
120 120
 	}
121 121
 
122
-	public function addEventsOnRun(JsUtils $js = NULL) {
123
-		$script = parent::addEventsOnRun($js);
124
-		$innerScript = $this->_self->getInnerScript();
125
-		if (! isset($innerScript)) {
122
+	public function addEventsOnRun(JsUtils $js=NULL) {
123
+		$script=parent::addEventsOnRun($js);
124
+		$innerScript=$this->_self->getInnerScript();
125
+		if (!isset($innerScript)) {
126 126
 			$this->_self->setInnerScript($script);
127 127
 		}
128 128
 		return $script;
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,10 +24,11 @@  discard block
 block discarded – undo
24 24
 
25 25
 	public function setBasic($very = false) {
26 26
 		$table = $this->_self;
27
-		if ($very)
28
-			$table->addToPropertyCtrl("class", "very", array(
27
+		if ($very) {
28
+					$table->addToPropertyCtrl("class", "very", array(
29 29
 				"very"
30 30
 			));
31
+		}
31 32
 		return $table->addToPropertyCtrl("class", "basic", array(
32 33
 			"basic"
33 34
 		));
@@ -35,10 +36,11 @@  discard block
 block discarded – undo
35 36
 
36 37
 	public function setCompact($very = false) {
37 38
 		$table = $this->_self;
38
-		if ($very)
39
-			$table->addToPropertyCtrl("class", "very", array(
39
+		if ($very) {
40
+					$table->addToPropertyCtrl("class", "very", array(
40 41
 				"very"
41 42
 			));
43
+		}
42 44
 		return $table->addToPropertyCtrl("class", "compact", array(
43 45
 			"compact"
44 46
 		));
Please login to merge, or discard this patch.
Ajax/semantic/html/elements/HtmlList.php 2 patches
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -13,9 +13,9 @@  discard block
 block discarded – undo
13 13
 
14 14
 	protected $_hasCheckedList;
15 15
 
16
-	protected $_fireOnInit = false;
16
+	protected $_fireOnInit=false;
17 17
 
18
-	protected $_ckItemChange = "";
18
+	protected $_ckItemChange="";
19 19
 
20 20
 	protected $_maxVisible;
21 21
 
@@ -23,25 +23,25 @@  discard block
 block discarded – undo
23 23
 
24 24
 	protected $_visibility;
25 25
 
26
-	public function __construct($identifier, $items = array()) {
26
+	public function __construct($identifier, $items=array()) {
27 27
 		parent::__construct($identifier, "div", "ui list");
28 28
 		$this->addItems($items);
29
-		$this->_hasCheckedList = false;
29
+		$this->_hasCheckedList=false;
30 30
 	}
31 31
 
32 32
 	protected function createItem($value) {
33
-		$count = $this->count();
34
-		$item = new HtmlListItem("item-" . $this->identifier . "-" . $count, $value);
33
+		$count=$this->count();
34
+		$item=new HtmlListItem("item-".$this->identifier."-".$count, $value);
35 35
 		return $item;
36 36
 	}
37 37
 
38 38
 	public function addHeader($niveau, $content) {
39
-		$header = new HtmlHeader("header-" . $this->identifier, $niveau, $content, "page");
39
+		$header=new HtmlHeader("header-".$this->identifier, $niveau, $content, "page");
40 40
 		$this->wrap($header);
41 41
 		return $header;
42 42
 	}
43 43
 
44
-	public function getItemPart($index, $partName = "header") {
44
+	public function getItemPart($index, $partName="header") {
45 45
 		return $this->getItem($index)->getPart($partName);
46 46
 	}
47 47
 
@@ -49,15 +49,15 @@  discard block
 block discarded – undo
49 49
 		return $this->contentAs($tagName);
50 50
 	}
51 51
 
52
-	public function asLinks($hrefs = [], $target = NUll) {
52
+	public function asLinks($hrefs=[], $target=NUll) {
53 53
 		$this->addToPropertyCtrl("class", "link", array(
54 54
 			"link"
55 55
 		));
56 56
 		return parent::asLinks($hrefs, $target);
57 57
 	}
58 58
 
59
-	public function addList($items = array()) {
60
-		$list = new HtmlList("", $items);
59
+	public function addList($items=array()) {
60
+		$list=new HtmlList("", $items);
61 61
 		$list->setClass("list");
62 62
 		return $this->addItem($list);
63 63
 	}
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	}
72 72
 
73 73
 	protected function getItemToAdd($item) {
74
-		$itemO = parent::getItemToAdd($item);
74
+		$itemO=parent::getItemToAdd($item);
75 75
 		if ($itemO instanceof AbstractCheckbox)
76 76
 			$itemO->addClass("item");
77 77
 		return $itemO;
@@ -90,11 +90,11 @@  discard block
 block discarded – undo
90 90
 	}
91 91
 
92 92
 	public function run(JsUtils $js) {
93
-		if ($this->_hasCheckedList === true) {
94
-			$jsCode = include dirname(__FILE__) . '/../../components/jsTemplates/tplCheckedList.php';
95
-			$jsCode = \str_replace("%identifier%", "#" . $this->identifier, $jsCode);
96
-			$jsCode = \str_replace("%fireOnInit%", $this->_fireOnInit, $jsCode);
97
-			$jsCode = \str_replace("%onChange%", $this->_ckItemChange, $jsCode);
93
+		if ($this->_hasCheckedList===true) {
94
+			$jsCode=include dirname(__FILE__).'/../../components/jsTemplates/tplCheckedList.php';
95
+			$jsCode=\str_replace("%identifier%", "#".$this->identifier, $jsCode);
96
+			$jsCode=\str_replace("%fireOnInit%", $this->_fireOnInit, $jsCode);
97
+			$jsCode=\str_replace("%onChange%", $this->_ckItemChange, $jsCode);
98 98
 			$this->executeOnRun($jsCode);
99 99
 		}
100 100
 		/*
@@ -106,19 +106,19 @@  discard block
 block discarded – undo
106 106
 	}
107 107
 
108 108
 	protected function addFollowPoints() {
109
-		$count = $this->count();
110
-		for ($i = $this->_maxVisible; $i < $count; $i ++) {
109
+		$count=$this->count();
110
+		for ($i=$this->_maxVisible; $i<$count; $i++) {
111 111
 			$this->getItem($i)
112 112
 				->addClass("notVisible")
113 113
 				->setProperty("style", "display: none;");
114 114
 		}
115
-		$item = $this->addItem("...");
115
+		$item=$this->addItem("...");
116 116
 		$item->addClass("points");
117
-		$item->onClick('$(this).hide();$("#' . $this->identifier . ' .notVisible").show();');
117
+		$item->onClick('$(this).hide();$("#'.$this->identifier.' .notVisible").show();');
118 118
 	}
119 119
 
120 120
 	public function onCkItemChange($jsCode) {
121
-		$this->_ckItemChange = $jsCode;
121
+		$this->_ckItemChange=$jsCode;
122 122
 	}
123 123
 
124 124
 	/**
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	 * @param boolean $fireOnInit
127 127
 	 */
128 128
 	public function setFireOnInit($fireOnInit) {
129
-		$this->_fireOnInit = $fireOnInit;
129
+		$this->_fireOnInit=$fireOnInit;
130 130
 	}
131 131
 
132 132
 	public function setRelaxed() {
@@ -150,15 +150,15 @@  discard block
 block discarded – undo
150 150
 	 * {@inheritdoc}
151 151
 	 * @see \Ajax\common\html\HtmlCollection::compile()
152 152
 	 */
153
-	public function compile(JsUtils $js = NULL, &$view = NULL) {
154
-		if (isset($this->_maxVisible) && $this->_maxVisible < $this->count()) {
153
+	public function compile(JsUtils $js=NULL, &$view=NULL) {
154
+		if (isset($this->_maxVisible) && $this->_maxVisible<$this->count()) {
155 155
 			$this->addFollowPoints();
156 156
 			if (isset($js)) {
157
-				$visibility = new Visibility($js);
158
-				$visibility->attach("#" . $this->identifier);
157
+				$visibility=new Visibility($js);
158
+				$visibility->attach("#".$this->identifier);
159 159
 				$visibility->setOnTopVisible("$(this).children('.notVisible').hide();$(this).find('.points').show();");
160 160
 				$visibility->compile($js, $view);
161
-				$this->_visibility = $visibility;
161
+				$this->_visibility=$visibility;
162 162
 			}
163 163
 		}
164 164
 		return parent::compile($js, $view);
@@ -173,21 +173,21 @@  discard block
 block discarded – undo
173 173
 	 * @param string $notAllChecked
174 174
 	 * @return HtmlList
175 175
 	 */
176
-	public function addCheckedList($items = array(), $masterItem = NULL, $values = array(), $notAllChecked = false, $name = null) {
177
-		$count = $this->count();
178
-		$identifier = $this->identifier . "-" . $count;
176
+	public function addCheckedList($items=array(), $masterItem=NULL, $values=array(), $notAllChecked=false, $name=null) {
177
+		$count=$this->count();
178
+		$identifier=$this->identifier."-".$count;
179 179
 		if (isset($masterItem)) {
180 180
 			if (\is_array($masterItem)) {
181
-				$masterO = new HtmlFormCheckbox("master-" . $identifier, @$masterItem[0], @$masterItem[1]);
181
+				$masterO=new HtmlFormCheckbox("master-".$identifier, @$masterItem[0], @$masterItem[1]);
182 182
 				if (isset($name))
183 183
 					$masterO->setName($name);
184 184
 				if (isset($masterItem[1])) {
185
-					if (\array_search($masterItem[1], $values) !== false) {
185
+					if (\array_search($masterItem[1], $values)!==false) {
186 186
 						$masterO->getDataField()->setProperty("checked", "");
187 187
 					}
188 188
 				}
189 189
 			} else {
190
-				$masterO = new HtmlFormCheckbox("master-" . $identifier, $masterItem);
190
+				$masterO=new HtmlFormCheckbox("master-".$identifier, $masterItem);
191 191
 			}
192 192
 			if ($notAllChecked) {
193 193
 				$masterO->getDataField()->addClass("_notAllChecked");
@@ -196,36 +196,36 @@  discard block
 block discarded – undo
196 196
 			$masterO->setClass("item");
197 197
 			$this->addItem($masterO);
198 198
 		}
199
-		$fields = array();
200
-		$i = 0;
201
-		$this->setFireOnInit(UString::getBooleanStr($this->_fireOnInit || count($items) < 30));
199
+		$fields=array();
200
+		$i=0;
201
+		$this->setFireOnInit(UString::getBooleanStr($this->_fireOnInit || count($items)<30));
202 202
 		foreach ($items as $val => $caption) {
203
-			$itemO = new HtmlFormCheckbox($identifier . "-" . $i ++, $caption, $val, "child");
204
-			if (\array_search($val, $values) !== false) {
203
+			$itemO=new HtmlFormCheckbox($identifier."-".$i++, $caption, $val, "child");
204
+			if (\array_search($val, $values)!==false) {
205 205
 				$itemO->getDataField()->setProperty("checked", "");
206 206
 			}
207 207
 			if (isset($name))
208 208
 				$itemO->setName($name);
209 209
 			$itemO->setClass("item");
210
-			$fields[] = $itemO;
210
+			$fields[]=$itemO;
211 211
 		}
212
-		if (isset($masterO) === true) {
213
-			$list = new HtmlList("", $fields);
212
+		if (isset($masterO)===true) {
213
+			$list=new HtmlList("", $fields);
214 214
 			$list->setClass("list");
215 215
 			$masterO->addContent($list);
216 216
 		} else {
217 217
 			$this->addList($fields);
218 218
 		}
219
-		$this->_hasCheckedList = true;
219
+		$this->_hasCheckedList=true;
220 220
 		return $this;
221 221
 	}
222 222
 
223 223
 	public function setIcons($icons) {
224
-		if (! \is_array($icons)) {
225
-			$icons = \array_fill(0, \sizeof($this->content), $icons);
224
+		if (!\is_array($icons)) {
225
+			$icons=\array_fill(0, \sizeof($this->content), $icons);
226 226
 		}
227
-		$max = \min(\sizeof($icons), \sizeof($this->content));
228
-		for ($i = 0; $i < $max; $i ++) {
227
+		$max=\min(\sizeof($icons), \sizeof($this->content));
228
+		for ($i=0; $i<$max; $i++) {
229 229
 			$this->content[$i]->addIcon($icons[$i]);
230 230
 		}
231 231
 		return $this;
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 	 * @param mixed $_maxVisible
245 245
 	 */
246 246
 	public function setMaxVisible($_maxVisible) {
247
-		$this->_maxVisible = $_maxVisible;
247
+		$this->_maxVisible=$_maxVisible;
248 248
 		return $this;
249 249
 	}
250 250
 }
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -72,8 +72,9 @@  discard block
 block discarded – undo
72 72
 
73 73
 	protected function getItemToAdd($item) {
74 74
 		$itemO = parent::getItemToAdd($item);
75
-		if ($itemO instanceof AbstractCheckbox)
76
-			$itemO->addClass("item");
75
+		if ($itemO instanceof AbstractCheckbox) {
76
+					$itemO->addClass("item");
77
+		}
77 78
 		return $itemO;
78 79
 	}
79 80
 
@@ -179,8 +180,9 @@  discard block
 block discarded – undo
179 180
 		if (isset($masterItem)) {
180 181
 			if (\is_array($masterItem)) {
181 182
 				$masterO = new HtmlFormCheckbox("master-" . $identifier, @$masterItem[0], @$masterItem[1]);
182
-				if (isset($name))
183
-					$masterO->setName($name);
183
+				if (isset($name)) {
184
+									$masterO->setName($name);
185
+				}
184 186
 				if (isset($masterItem[1])) {
185 187
 					if (\array_search($masterItem[1], $values) !== false) {
186 188
 						$masterO->getDataField()->setProperty("checked", "");
@@ -204,8 +206,9 @@  discard block
 block discarded – undo
204 206
 			if (\array_search($val, $values) !== false) {
205 207
 				$itemO->getDataField()->setProperty("checked", "");
206 208
 			}
207
-			if (isset($name))
208
-				$itemO->setName($name);
209
+			if (isset($name)) {
210
+							$itemO->setName($name);
211
+			}
209 212
 			$itemO->setClass("item");
210 213
 			$fields[] = $itemO;
211 214
 		}
Please login to merge, or discard this patch.