Completed
Push — master ( 864cd0...5654ad )
by Jean-Christophe
03:12
created
Ajax/semantic/html/collections/HtmlGrid.php 1 patch
Braces   +24 added lines, -16 removed lines patch added patch discarded remove patch
@@ -32,8 +32,9 @@  discard block
 block discarded – undo
32 32
 			// }
33 33
 			$this->setWide($numCols);
34 34
 		}
35
-		if($createCols)
36
-			$this->setRowsCount($numRows, $numCols);
35
+		if($createCols) {
36
+					$this->setRowsCount($numRows, $numCols);
37
+		}
37 38
 	}
38 39
 
39 40
 	public function asSegment() {
@@ -85,8 +86,9 @@  discard block
 block discarded – undo
85 86
 	public function addCol($width=NULL) {
86 87
 		$colCount=$this->colCount() + 1;
87 88
 		$this->setColsCount($colCount, true, $width);
88
-		if ($this->hasOnlyCols($this->count()))
89
-			return $this->content[$colCount - 1];
89
+		if ($this->hasOnlyCols($this->count())) {
90
+					return $this->content[$colCount - 1];
91
+		}
90 92
 		return $this;
91 93
 	}
92 94
 
@@ -174,8 +176,9 @@  discard block
 block discarded – undo
174 176
 	 */
175 177
 	public function rowCount() {
176 178
 		$count=$this->count();
177
-		if ($this->hasOnlyCols($count))
178
-			return 0;
179
+		if ($this->hasOnlyCols($count)) {
180
+					return 0;
181
+		}
179 182
 		return $count;
180 183
 	}
181 184
 
@@ -185,10 +188,12 @@  discard block
 block discarded – undo
185 188
 	 */
186 189
 	public function colCount() {
187 190
 		$count=$this->count();
188
-		if ($this->hasOnlyCols($count))
189
-			return $count;
190
-		if ($count > 0)
191
-			return $this->getItem(0)->count();
191
+		if ($this->hasOnlyCols($count)) {
192
+					return $count;
193
+		}
194
+		if ($count > 0) {
195
+					return $this->getItem(0)->count();
196
+		}
192 197
 		return 0;
193 198
 	}
194 199
 
@@ -199,8 +204,9 @@  discard block
 block discarded – undo
199 204
 	 * @return \Ajax\semantic\html\collections\HtmlGridCol
200 205
 	 */
201 206
 	public function getCell($row, $col) {
202
-		if ($row < 2 && $this->hasOnlyCols($this->count()))
203
-			return $this->getItem($col);
207
+		if ($row < 2 && $this->hasOnlyCols($this->count())) {
208
+					return $this->getItem($col);
209
+		}
204 210
 		$row=$this->getItem($row);
205 211
 		if (isset($row)) {
206 212
 			$col=$row->getItem($col);
@@ -249,8 +255,9 @@  discard block
 block discarded – undo
249 255
 	 * @return \Ajax\semantic\html\collections\HtmlGrid
250 256
 	 */
251 257
 	public function setPadded($value=NULL) {
252
-		if (isset($value))
253
-			$this->addToPropertyCtrl("class", $value, array ("vertically","horizontally" ));
258
+		if (isset($value)) {
259
+					$this->addToPropertyCtrl("class", $value, array ("vertically","horizontally" ));
260
+		}
254 261
 		return $this->addToProperty("class", "padded");
255 262
 	}
256 263
 
@@ -275,8 +282,9 @@  discard block
 block discarded – undo
275 282
 	 * @see \Ajax\common\html\HtmlCollection::createItem()
276 283
 	 */
277 284
 	protected function createItem($value) {
278
-		if ($this->_createCols === false)
279
-			$value=null;
285
+		if ($this->_createCols === false) {
286
+					$value=null;
287
+		}
280 288
 		$item=new HtmlGridRow($this->identifier . "-row-" . ($this->count() + 1), $value, $this->_colSizing, $this->_implicitRows);
281 289
 		return $item;
282 290
 	}
Please login to merge, or discard this patch.
Ajax/common/html/HtmlDoubleElement.php 1 patch
Braces   +12 added lines, -10 removed lines patch added patch discarded remove patch
@@ -29,15 +29,17 @@  discard block
 block discarded – undo
29 29
 
30 30
 	public function addContent($content,$before=false) {
31 31
 		if (!\is_array($this->content)) {
32
-			if(isset($this->content))
33
-				$this->content=array ($this->content);
34
-			else
35
-				$this->content=array();
32
+			if(isset($this->content)) {
33
+							$this->content=array ($this->content);
34
+			} else {
35
+							$this->content=array();
36
+			}
37
+		}
38
+		if($before) {
39
+					array_unshift($this->content,$content);
40
+		} else {
41
+					$this->content []=$content;
36 42
 		}
37
-		if($before)
38
-			array_unshift($this->content,$content);
39
-		else
40
-			$this->content []=$content;
41 43
 		return $this;
42 44
 	}
43 45
 
@@ -75,9 +77,9 @@  discard block
 block discarded – undo
75 77
 		$instances=[];
76 78
 		if($content instanceof $class){
77 79
 			$instances[]=$content;
78
-		}elseif($content instanceof HtmlDoubleElement){
80
+		} elseif($content instanceof HtmlDoubleElement){
79 81
 			$instances=\array_merge($instances,$content->getContentInstances($class));
80
-		}elseif (\is_array($content)){
82
+		} elseif (\is_array($content)){
81 83
 			foreach ($content as $element){
82 84
 				$instances=\array_merge($instances,$this->_getContentInstances($class, $element));
83 85
 			}
Please login to merge, or discard this patch.
Ajax/common/html/html5/HtmlInput.php 1 patch
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -17,8 +17,9 @@  discard block
 block discarded – undo
17 17
 	}
18 18
 
19 19
 	public function setValue($value) {
20
-		if(isset($value))
21
-		$this->setProperty("value", $value);
20
+		if(isset($value)) {
21
+				$this->setProperty("value", $value);
22
+		}
22 23
 		return $this;
23 24
 	}
24 25
 
@@ -27,16 +28,18 @@  discard block
 block discarded – undo
27 28
 	}
28 29
 
29 30
 	public function setPlaceholder($value){
30
-		if(JString::isNotNull($value))
31
-			$this->_placeholder=$value;
31
+		if(JString::isNotNull($value)) {
32
+					$this->_placeholder=$value;
33
+		}
32 34
 		return $this;
33 35
 	}
34 36
 
35 37
 	public function compile(JsUtils $js=NULL,&$view=NULL){
36 38
 		$value=$this->_placeholder;
37 39
 		if(JString::isNull($value)){
38
-			if(JString::isNotNull($this->getProperty("name")))
39
-				$value=\ucfirst($this->getProperty("name"));
40
+			if(JString::isNotNull($this->getProperty("name"))) {
41
+							$value=\ucfirst($this->getProperty("name"));
42
+			}
40 43
 		}
41 44
 		$this->setProperty("placeholder", $value);
42 45
 		return parent::compile($js,$view);
Please login to merge, or discard this patch.
Ajax/common/Widget.php 1 patch
Braces   +7 added lines, -5 removed lines patch added patch discarded remove patch
@@ -186,8 +186,9 @@  discard block
 block discarded – undo
186 186
 	 */
187 187
 	public function addItemInToolbar($caption,$icon=NULL,$callback=NULL){
188 188
 		$result=$this->addInToolbar($caption,$callback);
189
-		if(isset($icon))
190
-			$result->addIcon($icon);
189
+		if(isset($icon)) {
190
+					$result->addIcon($icon);
191
+		}
191 192
 		return $result;
192 193
 	}
193 194
 
@@ -201,7 +202,7 @@  discard block
 block discarded – undo
201 202
 			foreach ($items as $icon=>$item){
202 203
 				$this->addItemInToolbar($item,$icon,$callback);
203 204
 			}
204
-		}else{
205
+		} else{
205 206
 			foreach ($items as $item){
206 207
 				$this->addItemInToolbar($item,null,$callback);
207 208
 			}
@@ -352,8 +353,9 @@  discard block
 block discarded – undo
352 353
 	protected function _compileForm(){
353 354
 		if(isset($this->_form)){
354 355
 			$noValidate="";
355
-			if(\sizeof($this->_form->getValidationParams())>0)
356
-				$noValidate="novalidate";
356
+			if(\sizeof($this->_form->getValidationParams())>0) {
357
+							$noValidate="novalidate";
358
+			}
357 359
 			$this->wrapContent("<form class='ui form' id='frm-".$this->identifier."' name='frm-".$this->identifier."' ".$noValidate.">","</form>");
358 360
 		}
359 361
 	}
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/HtmlForm.php 1 patch
Braces   +25 added lines, -17 removed lines patch added patch discarded remove patch
@@ -52,8 +52,9 @@  discard block
 block discarded – undo
52 52
 	 */
53 53
 	public function addHeader($title, $niveau=1, $dividing=true) {
54 54
 		$header=new HtmlHeader("", $niveau, $title);
55
-		if ($dividing)
56
-			$header->setDividing();
55
+		if ($dividing) {
56
+					$header->setDividing();
57
+		}
57 58
 		return $this->addItem($header);
58 59
 	}
59 60
 
@@ -74,14 +75,16 @@  discard block
 block discarded – undo
74 75
 					if (\is_string($end)) {
75 76
 						$label=$end;
76 77
 						\array_pop($fields);
77
-					} else
78
-						$label=NULL;
78
+					} else {
79
+											$label=NULL;
80
+					}
79 81
 				}
80 82
 				$this->_fields=\array_merge($this->_fields, $fields);
81 83
 				$fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count(), $fields);
82 84
 			}
83
-			if (isset($label))
84
-				$fields=new HtmlFormField("", $fields, $label);
85
+			if (isset($label)) {
86
+							$fields=new HtmlFormField("", $fields, $label);
87
+			}
85 88
 		} else {
86 89
 			$fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count());
87 90
 		}
@@ -134,27 +137,31 @@  discard block
 block discarded – undo
134 137
 	 */
135 138
 	public function addMessage($identifier, $content, $header=NULL, $icon=NULL, $type=NULL) {
136 139
 		$message=new HtmlMessage($identifier, $content);
137
-		if (isset($header))
138
-			$message->addHeader($header);
139
-		if (isset($icon))
140
-			$message->setIcon($icon);
141
-		if (isset($type))
142
-			$message->setStyle($type);
140
+		if (isset($header)) {
141
+					$message->addHeader($header);
142
+		}
143
+		if (isset($icon)) {
144
+					$message->setIcon($icon);
145
+		}
146
+		if (isset($type)) {
147
+					$message->setStyle($type);
148
+		}
143 149
 		return $this->addItem($message);
144 150
 	}
145 151
 
146 152
 
147 153
 
148 154
 	public function compile(JsUtils $js=NULL,&$view=NULL){
149
-		if(\sizeof($this->_validationParams)>0)
150
-			$this->setProperty("novalidate", "");
155
+		if(\sizeof($this->_validationParams)>0) {
156
+					$this->setProperty("novalidate", "");
157
+		}
151 158
 		return parent::compile($js,$view);
152 159
 	}
153 160
 
154 161
 	public function run(JsUtils $js) {
155 162
 		if(isset($js)){
156 163
 			$compo=$js->semantic()->form("#".$this->identifier);
157
-		}else{
164
+		} else{
158 165
 			$compo=new Form();
159 166
 			$compo->attach("#".$this->identifier);
160 167
 		}
@@ -167,8 +174,9 @@  discard block
 block discarded – undo
167 174
 			if($field instanceof HtmlFormFields){
168 175
 				$items=$field->getItems();
169 176
 				foreach ($items as $_field){
170
-					if($_field instanceof HtmlFormField)
171
-						$compo=$this->addCompoValidation($compo, $_field);
177
+					if($_field instanceof HtmlFormField) {
178
+											$compo=$this->addCompoValidation($compo, $_field);
179
+					}
172 180
 				}
173 181
 			}
174 182
 		}
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/table/traits/TableTrait.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -17,15 +17,17 @@
 block discarded – undo
17 17
 
18 18
 	public function setBasic($very=false) {
19 19
 		$table=$this->getTable();
20
-		if ($very)
21
-			$table->addToPropertyCtrl("class", "very", array ("very" ));
20
+		if ($very) {
21
+					$table->addToPropertyCtrl("class", "very", array ("very" ));
22
+		}
22 23
 		return $table->addToPropertyCtrl("class", "basic", array ("basic" ));
23 24
 	}
24 25
 
25 26
 	public function setCompact($very=false) {
26 27
 		$table=$this->getTable();
27
-		if ($very)
28
-			$table->addToPropertyCtrl("class", "very", array ("very" ));
28
+		if ($very) {
29
+					$table->addToPropertyCtrl("class", "very", array ("very" ));
30
+		}
29 31
 		return $table->addToPropertyCtrl("class", "compact", array ("compact" ));
30 32
 	}
31 33
 
Please login to merge, or discard this patch.
Ajax/common/html/traits/BaseHtmlPropertiesTrait.php 1 patch
Braces   +17 added lines, -12 removed lines patch added patch discarded remove patch
@@ -33,8 +33,9 @@  discard block
 block discarded – undo
33 33
 	}
34 34
 
35 35
 	public function getProperty($name) {
36
-		if (array_key_exists($name, $this->properties))
37
-			return $this->properties[$name];
36
+		if (array_key_exists($name, $this->properties)) {
37
+					return $this->properties[$name];
38
+		}
38 39
 	}
39 40
 
40 41
 	public function addToProperty($name, $value, $separator=" ") {
@@ -44,10 +45,11 @@  discard block
 block discarded – undo
44 45
 			}
45 46
 		} else if ($value !== "" && $this->propertyContains($name, $value) === false) {
46 47
 			$v=@$this->properties[$name];
47
-			if (isset($v) && $v !== "")
48
-				$v=$v . $separator . $value;
49
-				else
50
-					$v=$value;
48
+			if (isset($v) && $v !== "") {
49
+							$v=$v . $separator . $value;
50
+			} else {
51
+									$v=$value;
52
+				}
51 53
 
52 54
 					return $this->setProperty($name, $v);
53 55
 		}
@@ -70,8 +72,9 @@  discard block
 block discarded – undo
70 72
 	}
71 73
 
72 74
 	protected function addToPropertyUnique($name, $value, $typeCtrl) {
73
-		if (@class_exists($typeCtrl, true))
74
-			$typeCtrl=$typeCtrl::getConstants();
75
+		if (@class_exists($typeCtrl, true)) {
76
+					$typeCtrl=$typeCtrl::getConstants();
77
+		}
75 78
 			if (\is_array($typeCtrl)) {
76 79
 				$this->removeOldValues($this->properties[$name], $typeCtrl);
77 80
 			}
@@ -90,8 +93,9 @@  discard block
 block discarded – undo
90 93
 	}
91 94
 
92 95
 	public function removeProperty($name) {
93
-		if (\array_key_exists($name, $this->properties))
94
-			unset($this->properties[$name]);
96
+		if (\array_key_exists($name, $this->properties)) {
97
+					unset($this->properties[$name]);
98
+		}
95 99
 			return $this;
96 100
 	}
97 101
 
@@ -104,8 +108,9 @@  discard block
 block discarded – undo
104 108
 	}
105 109
 
106 110
 	protected function setPropertyCtrl($name, $value, $typeCtrl) {
107
-		if ($this->ctrl($name, $value, $typeCtrl) === true)
108
-			return $this->setProperty($name, $value);
111
+		if ($this->ctrl($name, $value, $typeCtrl) === true) {
112
+					return $this->setProperty($name, $value);
113
+		}
109 114
 			return $this;
110 115
 	}
111 116
 
Please login to merge, or discard this patch.
Ajax/common/html/BaseHtml.php 1 patch
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -99,15 +99,18 @@  discard block
 block discarded – undo
99 99
 			$flag=false;
100 100
 			$index=0;
101 101
 			while ( !$flag && $index < sizeof($elements) ) {
102
-				if ($elements[$index] instanceof BaseHtml)
103
-					$flag=($callback($elements[$index]));
102
+				if ($elements[$index] instanceof BaseHtml) {
103
+									$flag=($callback($elements[$index]));
104
+				}
104 105
 					$index++;
105 106
 			}
106
-			if ($flag === true)
107
-				return $elements[$index - 1];
107
+			if ($flag === true) {
108
+							return $elements[$index - 1];
109
+			}
108 110
 		} elseif ($elements instanceof BaseHtml) {
109
-			if ($callback($elements))
110
-				return $elements;
111
+			if ($callback($elements)) {
112
+							return $elements;
113
+			}
111 114
 		}
112 115
 		return null;
113 116
 	}
@@ -140,8 +143,9 @@  discard block
 block discarded – undo
140 143
 
141 144
 	public function fromArray($array) {
142 145
 		foreach ( $this as $key => $value ) {
143
-			if(array_key_exists($key, $array)===true)
144
-				$this->_callSetter("set" . ucfirst($key), $key, $array[$key], $array);
146
+			if(array_key_exists($key, $array)===true) {
147
+							$this->_callSetter("set" . ucfirst($key), $key, $array[$key], $array);
148
+			}
145 149
 		}
146 150
 		foreach ( $array as $key => $value ) {
147 151
 			if($this->_callSetter($key, $key, $value, $array)===false){
Please login to merge, or discard this patch.
Ajax/semantic/widgets/base/InstanceViewer.php 1 patch
Braces   +41 added lines, -35 removed lines patch added patch discarded remove patch
@@ -21,8 +21,9 @@  discard block
 block discarded – undo
21 21
 		$this->widgetIdentifier=$identifier;
22 22
 		$this->values=[];
23 23
 		$this->afterCompile=[];
24
-		if(isset($instance))
25
-			$this->setInstance($instance);
24
+		if(isset($instance)) {
25
+					$this->setInstance($instance);
26
+		}
26 27
 		$this->setCaptions($captions);
27 28
 		$this->captionCallback=NULL;
28 29
 		$this->defaultValueFunction=function($name,$value){return $value;};
@@ -39,11 +40,13 @@  discard block
 block discarded – undo
39 40
 	}
40 41
 
41 42
 	public function getIdentifier($index=NULL){
42
-		if(!isset($index))
43
-			$index=self::$index;
43
+		if(!isset($index)) {
44
+					$index=self::$index;
45
+		}
44 46
 		$value=$index;
45
-		if(isset($this->values["identifier"]))
46
-			$value=$this->values["identifier"]($index,$this->instance);
47
+		if(isset($this->values["identifier"])) {
48
+					$value=$this->values["identifier"]($index,$this->instance);
49
+		}
47 50
 		return $value;
48 51
 	}
49 52
 
@@ -66,7 +69,7 @@  discard block
 block discarded – undo
66 69
 		$value=$property->getValue($this->instance);
67 70
 		if(isset($this->values[$index])){
68 71
 			$value= $this->values[$index]($value,$this->instance,$index);
69
-		}else{
72
+		} else{
70 73
 			$value=$this->_getDefaultValue($property->getName(),$value, $index);
71 74
 		}
72 75
 		return $value;
@@ -76,16 +79,16 @@  discard block
 block discarded – undo
76 79
 		$value=null;
77 80
 		if($property instanceof \ReflectionProperty){
78 81
 			$value=$this->_getPropertyValue($property, $index);
79
-		}else{
80
-			if(\is_callable($property))
81
-				$value=$property($this->instance);
82
-			elseif(\is_array($property)){
82
+		} else{
83
+			if(\is_callable($property)) {
84
+							$value=$property($this->instance);
85
+			} elseif(\is_array($property)){
83 86
 				$values=\array_map(function($v) use ($index){return $this->_getValue($v, $index);}, $property);
84 87
 				$value=\implode("", $values);
85
-			}else{
88
+			} else{
86 89
 				if(isset($this->values[$index])){
87 90
 					$value= $this->values[$index]($property,$this->instance,$index);
88
-				}elseif(isset($this->instance->{$property})){
91
+				} elseif(isset($this->instance->{$property})){
89 92
 					$value=$this->instance->{$property};
90 93
 				}
91 94
 			}
@@ -108,10 +111,10 @@  discard block
 block discarded – undo
108 111
 		if(isset($vb[$index])){
109 112
 			if(\is_array($vb[$index])){
110 113
 				$this->visibleProperties[$index][]=$field;
111
-			}else{
114
+			} else{
112 115
 				$this->visibleProperties[$index]=[$vb[$index],$field];
113 116
 			}
114
-		}else{
117
+		} else{
115 118
 			return $this->insertField($index, $field);
116 119
 		}
117 120
 		return $this;
@@ -138,9 +141,9 @@  discard block
 block discarded – undo
138 141
 		$property=$this->getProperty($index);
139 142
 		if($property instanceof \ReflectionProperty){
140 143
 			$result=$property->getName();
141
-		}elseif(\is_callable($property)){
144
+		} elseif(\is_callable($property)){
142 145
 			$result=$this->visibleProperties[$index];
143
-		}else{
146
+		} else{
144 147
 			$result=$property;
145 148
 		}
146 149
 		return $result;
@@ -160,7 +163,7 @@  discard block
 block discarded – undo
160 163
 		$this->reflect=new \ReflectionClass($instance);
161 164
 		if(\sizeof($this->visibleProperties)===0){
162 165
 			$this->properties=$this->getDefaultProperties();
163
-		}else{
166
+		} else{
164 167
 			foreach ($this->visibleProperties as $property){
165 168
 				$this->setInstanceProperty($property);
166 169
 			}
@@ -171,22 +174,23 @@  discard block
 block discarded – undo
171 174
 	private function setInstanceProperty($property){
172 175
 		if(\is_callable($property)){
173 176
 			$this->properties[]=$property;
174
-		}elseif(\is_string($property)){
177
+		} elseif(\is_string($property)){
175 178
 			try{
176 179
 				$this->_beforeAddProperty(\sizeof($this->properties), $property);
177 180
 				$rProperty=$this->reflect->getProperty($property);
178 181
 				$this->properties[]=$rProperty;
179
-			}catch(\Exception $e){
182
+			} catch(\Exception $e){
180 183
 				$this->_beforeAddProperty(\sizeof($this->properties), $property);
181 184
 				$this->properties[]=$property;
182 185
 			}
183
-		}elseif(\is_int($property)){
186
+		} elseif(\is_int($property)){
184 187
 			$props=$this->getDefaultProperties();
185
-			if(isset($props[$property]))
186
-				$this->properties[]=$props[$property];
187
-				else
188
-					$this->properties[]=$property;
189
-		}else{
188
+			if(isset($props[$property])) {
189
+							$this->properties[]=$props[$property];
190
+			} else {
191
+									$this->properties[]=$property;
192
+				}
193
+		} else{
190 194
 			$this->properties[]=$property;
191 195
 		}
192 196
 	}
@@ -230,12 +234,13 @@  discard block
 block discarded – undo
230 234
 		if(isset($this->captions[$index])){
231 235
 			return $this->captions[$index];
232 236
 		}
233
-		if($this->properties[$index] instanceof \ReflectionProperty)
234
-			return $this->properties[$index]->getName();
235
-		elseif(\is_callable($this->properties[$index]))
236
-			return "";
237
-		else
238
-			return $this->properties[$index];
237
+		if($this->properties[$index] instanceof \ReflectionProperty) {
238
+					return $this->properties[$index]->getName();
239
+		} elseif(\is_callable($this->properties[$index])) {
240
+					return "";
241
+		} else {
242
+					return $this->properties[$index];
243
+		}
239 244
 	}
240 245
 
241 246
 	public function getCaptions(){
@@ -244,7 +249,7 @@  discard block
 block discarded – undo
244 249
 			for($i=\sizeof($captions);$i<$this->count();$i++){
245 250
 				$captions[]="";
246 251
 			}
247
-		}else{
252
+		} else{
248 253
 			$captions=[];
249 254
 			$index=0;
250 255
 			$count=$this->count();
@@ -260,8 +265,9 @@  discard block
 block discarded – undo
260 265
 	}
261 266
 
262 267
 	public function setCaption($index,$caption){
263
-		if(isset($this->captions)===false)
264
-			$this->captions=[];
268
+		if(isset($this->captions)===false) {
269
+					$this->captions=[];
270
+		}
265 271
 		$this->captions[$index]=$caption;
266 272
 		return $this;
267 273
 	}
Please login to merge, or discard this patch.