Completed
Push — master ( 489615...9fed17 )
by Jean-Christophe
03:15
created
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.
Ajax/bootstrap/html/HtmlButtongroups.php 1 patch
Braces   +21 added lines, -17 removed lines patch added patch discarded remove patch
@@ -49,8 +49,9 @@  discard block
 block discarded – undo
49 49
 	}
50 50
 
51 51
 	public function setStyle($value) {
52
-		foreach ( $this->elements as $element )
53
-			$element->setStyle($value);
52
+		foreach ( $this->elements as $element ) {
53
+					$element->setStyle($value);
54
+		}
54 55
 	}
55 56
 
56 57
 	private function dropdownAsButton($bt) {
@@ -76,23 +77,25 @@  discard block
 block discarded – undo
76 77
 		} elseif (is_string($element)) {
77 78
 			$result=new HtmlButton($this->identifier."-button-".$iid,$element);
78 79
 		}
79
-		if($result instanceof HtmlButton)
80
-			$this->elements[]=$result;
80
+		if($result instanceof HtmlButton) {
81
+					$this->elements[]=$result;
82
+		}
81 83
 		return $result;
82 84
 	}
83 85
 
84 86
 	private function _addArrayElement(array $element,int $iid){
85
-		if (array_key_exists("glyph", $element))
86
-			$bt=new HtmlGlyphButton($this->identifier."-button-".$iid);
87
-		elseif (array_key_exists("btnCaption", $element)) {
88
-			if (array_key_exists("split", $element))
89
-				$bt=new HtmlSplitbutton($this->identifier."-dropdown-".$iid);
90
-			else{
87
+		if (array_key_exists("glyph", $element)) {
88
+					$bt=new HtmlGlyphButton($this->identifier."-button-".$iid);
89
+		} elseif (array_key_exists("btnCaption", $element)) {
90
+			if (array_key_exists("split", $element)) {
91
+							$bt=new HtmlSplitbutton($this->identifier."-dropdown-".$iid);
92
+			} else{
91 93
 				$bt=new HtmlDropdown($this->identifier."-dropdown-".$iid);
92 94
 				$this->dropdownAsButton($bt);
93 95
 			}
94
-		} else
95
-			$bt=new HtmlButton($this->identifier."-button-".$iid);
96
+		} else {
97
+					$bt=new HtmlButton($this->identifier."-button-".$iid);
98
+		}
96 99
 		$bt->fromArray($element);
97 100
 		return $bt;
98 101
 	}
@@ -115,8 +118,9 @@  discard block
 block discarded – undo
115 118
 	public function setAlignment($value) {
116 119
 		if (is_int($value)) {
117 120
 			$value=CssRef::alignment("btn-group")[$value];
118
-		} else
119
-			$value="btn-group-".$value;
121
+		} else {
122
+					$value="btn-group-".$value;
123
+		}
120 124
 		if (strstr($value, "justified")) {
121 125
 			foreach ( $this->elements as $element ) {
122 126
 				$element->wrap('<div class="btn-group" role="group">', '</div>');
@@ -131,9 +135,9 @@  discard block
 block discarded – undo
131 135
 	 * @return HtmlButton
132 136
 	 */
133 137
 	public function getElement($index) {
134
-		if (is_int($index))
135
-			return $this->elements[$index];
136
-		else {
138
+		if (is_int($index)) {
139
+					return $this->elements[$index];
140
+		} else {
137 141
 			$elm=$this->getElementById($index, $this->elements);
138 142
 			return $elm;
139 143
 		}
Please login to merge, or discard this patch.