Completed
Push — master ( 701cf4...686575 )
by Jean-Christophe
03:12
created
Ajax/semantic/widgets/base/InstanceViewer.php 1 patch
Braces   +38 added lines, -33 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;};
@@ -40,8 +41,9 @@  discard block
 block discarded – undo
40 41
 
41 42
 	public function getIdentifier(){
42 43
 		$value=self::$index;
43
-		if(isset($this->values["identifier"]))
44
-			$value=$this->values["identifier"](self::$index,$this->instance);
44
+		if(isset($this->values["identifier"])) {
45
+					$value=$this->values["identifier"](self::$index,$this->instance);
46
+		}
45 47
 		return $value;
46 48
 	}
47 49
 
@@ -65,19 +67,19 @@  discard block
 block discarded – undo
65 67
 			$value=$property->getValue($this->instance);
66 68
 			if(isset($this->values[$index])){
67 69
 				$value= $this->values[$index]($value,$this->instance,$index);
68
-			}else{
70
+			} else{
69 71
 				$value=$this->_getDefaultValue($property->getName(),$value, $index);
70 72
 			}
71
-		}else{
72
-			if(\is_callable($property))
73
-				$value=$property($this->instance);
74
-			elseif(\is_array($property)){
73
+		} else{
74
+			if(\is_callable($property)) {
75
+							$value=$property($this->instance);
76
+			} elseif(\is_array($property)){
75 77
 				$values=\array_map(function($v) use ($index){return $this->_getValue($v, $index);}, $property);
76 78
 				$value=\implode("", $values);
77
-			}else{
79
+			} else{
78 80
 				if(isset($this->values[$index])){
79 81
 					$value= $this->values[$index]($property,$this->instance,$index);
80
-				}else{
82
+				} else{
81 83
 					$value=$property;
82 84
 				}
83 85
 			}
@@ -100,10 +102,10 @@  discard block
 block discarded – undo
100 102
 		if(isset($vb[$index])){
101 103
 			if(\is_array($vb[$index])){
102 104
 				$this->visibleProperties[$index][]=$field;
103
-			}else{
105
+			} else{
104 106
 				$this->visibleProperties[$index]=[$vb[$index],$field];
105 107
 			}
106
-		}else{
108
+		} else{
107 109
 			return $this->insertField($index, $field);
108 110
 		}
109 111
 		return $this;
@@ -130,9 +132,9 @@  discard block
 block discarded – undo
130 132
 		$property=$this->getProperty($index);
131 133
 		if($property instanceof \ReflectionProperty){
132 134
 			$result=$property->getName();
133
-		}elseif(\is_callable($property)){
135
+		} elseif(\is_callable($property)){
134 136
 			$result=$this->visibleProperties[$index];
135
-		}else{
137
+		} else{
136 138
 			$result=$property;
137 139
 		}
138 140
 		return $result;
@@ -152,7 +154,7 @@  discard block
 block discarded – undo
152 154
 		$this->reflect=new \ReflectionClass($instance);
153 155
 		if(\sizeof($this->visibleProperties)===0){
154 156
 			$this->properties=$this->getDefaultProperties();
155
-		}else{
157
+		} else{
156 158
 			foreach ($this->visibleProperties as $property){
157 159
 				$this->setInstanceProperty($property);
158 160
 			}
@@ -163,22 +165,23 @@  discard block
 block discarded – undo
163 165
 	private function setInstanceProperty($property){
164 166
 		if(\is_callable($property)){
165 167
 			$this->properties[]=$property;
166
-		}elseif(\is_string($property)){
168
+		} elseif(\is_string($property)){
167 169
 			try{
168 170
 				$this->_beforeAddProperty(\sizeof($this->properties), $property);
169 171
 				$rProperty=$this->reflect->getProperty($property);
170 172
 				$this->properties[]=$rProperty;
171
-			}catch(\Exception $e){
173
+			} catch(\Exception $e){
172 174
 				$this->_beforeAddProperty(\sizeof($this->properties), $property);
173 175
 				$this->properties[]=$property;
174 176
 			}
175
-		}elseif(\is_int($property)){
177
+		} elseif(\is_int($property)){
176 178
 			$props=$this->getDefaultProperties();
177
-			if(isset($props[$property]))
178
-				$this->properties[]=$props[$property];
179
-				else
180
-					$this->properties[]=$property;
181
-		}else{
179
+			if(isset($props[$property])) {
180
+							$this->properties[]=$props[$property];
181
+			} else {
182
+									$this->properties[]=$property;
183
+				}
184
+		} else{
182 185
 			$this->properties[]=$property;
183 186
 		}
184 187
 	}
@@ -222,12 +225,13 @@  discard block
 block discarded – undo
222 225
 		if(isset($this->captions[$index])){
223 226
 			return $this->captions[$index];
224 227
 		}
225
-		if($this->properties[$index] instanceof \ReflectionProperty)
226
-			return $this->properties[$index]->getName();
227
-		elseif(\is_callable($this->properties[$index]))
228
-			return "";
229
-		else
230
-			return $this->properties[$index];
228
+		if($this->properties[$index] instanceof \ReflectionProperty) {
229
+					return $this->properties[$index]->getName();
230
+		} elseif(\is_callable($this->properties[$index])) {
231
+					return "";
232
+		} else {
233
+					return $this->properties[$index];
234
+		}
231 235
 	}
232 236
 
233 237
 	public function getCaptions(){
@@ -236,7 +240,7 @@  discard block
 block discarded – undo
236 240
 			for($i=\sizeof($captions);$i<$this->count();$i++){
237 241
 				$captions[]="";
238 242
 			}
239
-		}else{
243
+		} else{
240 244
 			$captions=[];
241 245
 			$index=0;
242 246
 			$count=$this->count();
@@ -252,8 +256,9 @@  discard block
 block discarded – undo
252 256
 	}
253 257
 
254 258
 	public function setCaption($index,$caption){
255
-		if(isset($this->captions)===false)
256
-			$this->captions=[];
259
+		if(isset($this->captions)===false) {
260
+					$this->captions=[];
261
+		}
257 262
 		$this->captions[$index]=$caption;
258 263
 		return $this;
259 264
 	}
Please login to merge, or discard this patch.
Ajax/semantic/widgets/dataform/FormInstanceViewer.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,8 +33,9 @@
 block discarded – undo
33 33
 
34 34
 
35 35
 	public function addSeparatorAfter($fieldNum){
36
-		if(\array_search($fieldNum, $this->separators)===false)
37
-			$this->separators[]=$fieldNum;
36
+		if(\array_search($fieldNum, $this->separators)===false) {
37
+					$this->separators[]=$fieldNum;
38
+		}
38 39
 			return $this;
39 40
 	}
40 41
 
Please login to merge, or discard this patch.
Ajax/semantic/html/content/HtmlAbsractItem.php 1 patch
Braces   +7 added lines, -5 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 			$this->setTagName("div");
58 58
 			$this->removeProperty("href");
59 59
 			$this->addToPropertyCtrl("class", "active", array("active"));
60
-		}else{
60
+		} else{
61 61
 			$this->removePropertyValue("class", "active");
62 62
 		}
63 63
 		return $this;
@@ -65,8 +65,9 @@  discard block
 block discarded – undo
65 65
 
66 66
 	public function asLink($href=NULL,$part=NULL){
67 67
 		$this->setTagName("a");
68
-		if(isset($href))
69
-			$this->setProperty("href", $href);
68
+		if(isset($href)) {
69
+					$this->setProperty("href", $href);
70
+		}
70 71
 		return $this;
71 72
 	}
72 73
 
@@ -77,8 +78,9 @@  discard block
 block discarded – undo
77 78
 	 * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile()
78 79
 	 */
79 80
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
80
-		if(\is_array($this->content) && JArray::isAssociative($this->content))
81
-			$this->content=JArray::sortAssociative($this->content, [ "icon","image","content" ]);
81
+		if(\is_array($this->content) && JArray::isAssociative($this->content)) {
82
+					$this->content=JArray::sortAssociative($this->content, [ "icon","image","content" ]);
83
+		}
82 84
 		return parent::compile($js, $view);
83 85
 	}
84 86
 }
85 87
\ No newline at end of file
Please login to merge, or discard this patch.
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/semantic/widgets/dataform/DataForm.php 1 patch
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,14 +55,14 @@
 block discarded – undo
55 55
 			foreach ($values as $v){
56 56
 				$form->addField($v);
57 57
 			}
58
-		}else{
58
+		} else{
59 59
 			$separators[]=$count;
60 60
 			for($i=0;$i<$size;$i++){
61 61
 				$fields=\array_slice($values, $separators[$i]+1,$separators[$i+1]-$separators[$i]);
62 62
 				//TODO check why $fields is empty
63 63
 				if(\sizeof($fields)===1){
64 64
 					$form->addField($fields[0]);
65
-				}elseif(\sizeof($fields)>1){
65
+				} elseif(\sizeof($fields)>1){
66 66
 					$form->addFields($fields);
67 67
 					$i+=\sizeof($fields)-1;
68 68
 				}
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/HtmlForm.php 1 patch
Braces   +24 added lines, -16 removed lines patch added patch discarded remove patch
@@ -51,8 +51,9 @@  discard block
 block discarded – undo
51 51
 	 */
52 52
 	public function addHeader($title, $niveau=1, $dividing=true) {
53 53
 		$header=new HtmlHeader("", $niveau, $title);
54
-		if ($dividing)
55
-			$header->setDividing();
54
+		if ($dividing) {
55
+					$header->setDividing();
56
+		}
56 57
 		return $this->addItem($header);
57 58
 	}
58 59
 
@@ -73,14 +74,16 @@  discard block
 block discarded – undo
73 74
 					if (\is_string($end)) {
74 75
 						$label=$end;
75 76
 						\array_pop($fields);
76
-					} else
77
-						$label=NULL;
77
+					} else {
78
+											$label=NULL;
79
+					}
78 80
 				}
79 81
 				$this->_fields=\array_merge($this->_fields, $fields);
80 82
 				$fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count(), $fields);
81 83
 			}
82
-			if (isset($label))
83
-				$fields=new HtmlFormField("", $fields, $label);
84
+			if (isset($label)) {
85
+							$fields=new HtmlFormField("", $fields, $label);
86
+			}
84 87
 		} else {
85 88
 			$fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count());
86 89
 		}
@@ -133,20 +136,24 @@  discard block
 block discarded – undo
133 136
 	 */
134 137
 	public function addMessage($identifier, $content, $header=NULL, $icon=NULL, $type=NULL) {
135 138
 		$message=new HtmlMessage($identifier, $content);
136
-		if (isset($header))
137
-			$message->addHeader($header);
138
-		if (isset($icon))
139
-			$message->setIcon($icon);
140
-		if (isset($type))
141
-			$message->setStyle($type);
139
+		if (isset($header)) {
140
+					$message->addHeader($header);
141
+		}
142
+		if (isset($icon)) {
143
+					$message->setIcon($icon);
144
+		}
145
+		if (isset($type)) {
146
+					$message->setStyle($type);
147
+		}
142 148
 		return $this->addItem($message);
143 149
 	}
144 150
 
145 151
 
146 152
 
147 153
 	public function compile(JsUtils $js=NULL,&$view=NULL){
148
-		if(\sizeof($this->_validationParams)>0)
149
-			$this->setProperty("novalidate", "");
154
+		if(\sizeof($this->_validationParams)>0) {
155
+					$this->setProperty("novalidate", "");
156
+		}
150 157
 		return parent::compile($js,$view);
151 158
 	}
152 159
 
@@ -161,8 +168,9 @@  discard block
 block discarded – undo
161 168
 			if($field instanceof HtmlFormFields){
162 169
 				$items=$field->getItems();
163 170
 				foreach ($items as $_field){
164
-					if($_field instanceof HtmlFormField)
165
-						$compo=$this->addCompoValidation($js, $compo, $_field);
171
+					if($_field instanceof HtmlFormField) {
172
+											$compo=$this->addCompoValidation($js, $compo, $_field);
173
+					}
166 174
 				}
167 175
 			}
168 176
 		}
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/Widget.php 1 patch
Braces   +7 added lines, -5 removed lines patch added patch discarded remove patch
@@ -176,8 +176,9 @@  discard block
 block discarded – undo
176 176
 	 */
177 177
 	public function addItemInToolbar($caption,$icon=NULL,$callback=NULL){
178 178
 		$result=$this->addInToolbar($caption,$callback);
179
-		if(isset($icon))
180
-			$result->addIcon($icon);
179
+		if(isset($icon)) {
180
+					$result->addIcon($icon);
181
+		}
181 182
 		return $result;
182 183
 	}
183 184
 
@@ -191,7 +192,7 @@  discard block
 block discarded – undo
191 192
 			foreach ($items as $icon=>$item){
192 193
 				$this->addItemInToolbar($item,$icon,$callback);
193 194
 			}
194
-		}else{
195
+		} else{
195 196
 			foreach ($items as $item){
196 197
 				$this->addItemInToolbar($item,null,$callback);
197 198
 			}
@@ -342,8 +343,9 @@  discard block
 block discarded – undo
342 343
 	protected function _compileForm(JsUtils $js=NULL,&$view=NULL){
343 344
 		if(isset($this->_form)){
344 345
 			$noValidate="";
345
-			if(\sizeof($this->_form->getValidationParams())>0)
346
-				$noValidate="novalidate";
346
+			if(\sizeof($this->_form->getValidationParams())>0) {
347
+							$noValidate="novalidate";
348
+			}
347 349
 			$this->wrapContent("<form class='ui form' id='frm-".$this->identifier."' name='frm-".$this->identifier."' ".$noValidate.">","</form>");
348 350
 		}
349 351
 	}
Please login to merge, or discard this patch.
Ajax/semantic/widgets/base/FieldAsTrait.php 1 patch
Braces   +9 added lines, -7 removed lines patch added patch discarded remove patch
@@ -57,8 +57,7 @@  discard block
 block discarded – undo
57 57
 			$rules=$attributes["rules"];
58 58
 			if(\is_array($rules)){
59 59
 				$element->addRules($rules);
60
-			}
61
-			else{
60
+			} else{
62 61
 				$element->addRule($rules);
63 62
 			}
64 63
 			unset($attributes["rules"]);
@@ -118,8 +117,9 @@  discard block
 block discarded – undo
118 117
 	public function fieldAsHeader($index,$niveau=1,$icon=NULL,$attributes=NULL){
119 118
 		return $this->_fieldAs(function($id,$name,$value) use($niveau,$icon){
120 119
 			$header=new HtmlHeader($id,$niveau,$value);
121
-			if(isset($icon))
122
-				$header->asIcon($icon, $value);
120
+			if(isset($icon)) {
121
+							$header->asIcon($icon, $value);
122
+			}
123 123
 			return $header;
124 124
 		}, $index,$attributes,"header");
125 125
 	}
@@ -127,7 +127,9 @@  discard block
 block discarded – undo
127 127
 
128 128
 	public function fieldAsImage($index,$size=Size::MINI,$circular=false){
129 129
 		$this->setValueFunction($index,function($img) use($size,$circular){
130
-			$image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular)$image->setCircular();
130
+			$image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular) {
131
+				$image->setCircular();
132
+			}
131 133
 			return $image;
132 134
 		});
133 135
 			return $this;
@@ -211,7 +213,7 @@  discard block
 block discarded – undo
211 213
 			foreach ($types as $type=>$attributes){
212 214
 				$this->fieldAs($i++,$type,$attributes);
213 215
 			}
214
-		}else{
216
+		} else{
215 217
 			foreach ($types as $type){
216 218
 				$this->fieldAs($i++,$type);
217 219
 			}
@@ -224,7 +226,7 @@  discard block
 block discarded – undo
224 226
 		if(\method_exists($this, $method)){
225 227
 			if(!\is_array($attributes)){
226 228
 				$attributes=[$index];
227
-			}else{
229
+			} else{
228 230
 				\array_unshift($attributes, $index);
229 231
 			}
230 232
 			\call_user_func_array([$this,$method], $attributes);
Please login to merge, or discard this patch.