Completed
Push — master ( d551f2...460f9e )
by Jean-Christophe
03:07
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.