Completed
Push — master ( 462f88...b88904 )
by Jean-Christophe
03:19
created
Ajax/semantic/html/elements/HtmlButton.php 1 patch
Braces   +14 added lines, -11 removed lines patch added patch discarded remove patch
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
 	}
57 57
 
58 58
 	public function setFocusable($value=true) {
59
-		if ($value === true)
60
-			$this->setProperty("tabindex", "0");
61
-		else {
59
+		if ($value === true) {
60
+					$this->setProperty("tabindex", "0");
61
+		} else {
62 62
 			$this->removeProperty("tabindex");
63 63
 		}
64 64
 		return $this;
@@ -106,8 +106,9 @@  discard block
 block discarded – undo
106 106
 	 */
107 107
 	public function addLabel($label, $before=false, $icon=NULL) {
108 108
 		$this->tagName="div";$prefix="";
109
-		if($before)
110
-			$prefix="left ";
109
+		if($before) {
110
+					$prefix="left ";
111
+		}
111 112
 		$this->addToProperty("class", $prefix."labeled");
112 113
 		$this->content=new HtmlButton("button-" . $this->identifier, $this->content);
113 114
 		$this->content->setTagName("div");
@@ -141,12 +142,13 @@  discard block
 block discarded – undo
141 142
 		//TODO check button content
142 143
 		if(\is_array($this->content)){
143 144
 			foreach ($this->content as $content){
144
-				if($content instanceof HtmlButton)
145
-					$content->setColor($color);
145
+				if($content instanceof HtmlButton) {
146
+									$content->setColor($color);
147
+				}
146 148
 			}
149
+		} else {
150
+					parent::setColor($color);
147 151
 		}
148
-		else
149
-			parent::setColor($color);
150 152
 		return $this;
151 153
 	}
152 154
 
@@ -199,8 +201,9 @@  discard block
 block discarded – undo
199 201
 	 * @return HtmlButton
200 202
 	 */
201 203
 	public static function social($identifier, $social, $value=NULL) {
202
-		if ($value === NULL)
203
-			$value=\ucfirst($social);
204
+		if ($value === NULL) {
205
+					$value=\ucfirst($social);
206
+		}
204 207
 		$return=new HtmlButton($identifier, $value);
205 208
 		$return->addIcon($social);
206 209
 		return $return->addToPropertyCtrl("class", $social, Social::getConstants());
Please login to merge, or discard this patch.
Ajax/semantic/widgets/base/FieldAsTrait.php 1 patch
Braces   +18 added lines, -14 removed lines patch added patch discarded remove patch
@@ -64,8 +64,7 @@  discard block
 block discarded – undo
64 64
 			$rules=$attributes["rules"];
65 65
 			if(\is_array($rules)){
66 66
 				$element->addRules($rules);
67
-			}
68
-			else{
67
+			} else{
69 68
 				$element->addRule($rules);
70 69
 			}
71 70
 			unset($attributes["rules"]);
@@ -117,8 +116,9 @@  discard block
 block discarded – undo
117 116
 	public function fieldAsLabel($index,$icon=NULL,$attributes=NULL){
118 117
 		return $this->_fieldAs(function($id,$name,$value) use($icon){
119 118
 			$lbl=new HtmlLabel($id,$value);
120
-			if(isset($icon))
121
-				$lbl->addIcon($icon);
119
+			if(isset($icon)) {
120
+							$lbl->addIcon($icon);
121
+			}
122 122
 				return $lbl;
123 123
 		}, $index,$attributes,"label");
124 124
 	}
@@ -126,8 +126,9 @@  discard block
 block discarded – undo
126 126
 	public function fieldAsHeader($index,$niveau=1,$icon=NULL,$attributes=NULL){
127 127
 		return $this->_fieldAs(function($id,$name,$value) use($niveau,$icon){
128 128
 			$header=new HtmlHeader($id,$niveau,$value);
129
-			if(isset($icon))
130
-				$header->asIcon($icon, $value);
129
+			if(isset($icon)) {
130
+							$header->asIcon($icon, $value);
131
+			}
131 132
 			return $header;
132 133
 		}, $index,$attributes,"header");
133 134
 	}
@@ -135,7 +136,9 @@  discard block
 block discarded – undo
135 136
 
136 137
 	public function fieldAsImage($index,$size=Size::MINI,$circular=false){
137 138
 		$this->setValueFunction($index,function($img) use($size,$circular){
138
-			$image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular)$image->setCircular();
139
+			$image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular) {
140
+				$image->setCircular();
141
+			}
139 142
 			return $image;
140 143
 		});
141 144
 			return $this;
@@ -194,8 +197,9 @@  discard block
 block discarded – undo
194 197
 
195 198
 	public function fieldAsCheckbox($index,$attributes=NULL){
196 199
 		return $this->_fieldAs(function($id,$name,$value,$caption) use($attributes){
197
-			if($caption===null || $caption==="")
198
-				$caption="";
200
+			if($caption===null || $caption==="") {
201
+							$caption="";
202
+			}
199 203
 			$input=new HtmlFormCheckbox($id,$caption,$this->_instanceViewer->getIdentifier());
200 204
 			$input->setChecked(JString::isBooleanTrue($value));
201 205
 			return $this->_prepareFormFields($input, $name, $attributes);
@@ -232,14 +236,14 @@  discard block
 block discarded – undo
232 236
 		$i=0;
233 237
 		if(JArray::isAssociative($types)){
234 238
 			foreach ($types as $type=>$attributes){
235
-				if(\is_int($type))
236
-					$this->fieldAs($i++,$attributes,[]);
237
-				else{
239
+				if(\is_int($type)) {
240
+									$this->fieldAs($i++,$attributes,[]);
241
+				} else{
238 242
 					$type=preg_replace('/\d/', '', $type );
239 243
 					$this->fieldAs($i++,$type,$attributes);
240 244
 				}
241 245
 			}
242
-		}else{
246
+		} else{
243 247
 			foreach ($types as $type){
244 248
 				$this->fieldAs($i++,$type);
245 249
 			}
@@ -251,7 +255,7 @@  discard block
 block discarded – undo
251 255
 		if(\method_exists($this, $method)){
252 256
 			if(!\is_array($attributes)){
253 257
 				$attributes=[$index];
254
-			}else{
258
+			} else{
255 259
 				\array_unshift($attributes, $index);
256 260
 			}
257 261
 			\call_user_func_array([$this,$method], $attributes);
Please login to merge, or discard this patch.