Completed
Push — master ( 263c12...bbe42f )
by Jean-Christophe
06:53
created
Ajax/common/components/SimpleComponent.php 1 patch
Braces   +11 added lines, -8 removed lines patch added patch discarded remove patch
@@ -26,9 +26,9 @@  discard block
 block discarded – undo
26 26
 			$itemSelector=JString::getValueBetween($event);
27 27
 			if($event=="execute"){
28 28
 				$this->jquery_code_for_compile []=$jsCode;
29
-			}else if($event=="beforeExecute"){
29
+			} else if($event=="beforeExecute"){
30 30
 				\array_unshift($this->jquery_code_for_compile, $jsCode);
31
-			}else{
31
+			} else{
32 32
 				$selector=$this->_createSelector($itemSelector, $this->attachTo);
33 33
 				$this->jquery_code_for_compile []="$( \"".$selector."\" ).on(\"".$event."\" , function( event, data ) {".$jsCode."});";
34 34
 			}
@@ -36,10 +36,12 @@  discard block
 block discarded – undo
36 36
 	}
37 37
 
38 38
 	protected function _createSelector($itemSelector,$selector){
39
-		if(!isset($itemSelector))
40
-			$itemSelector=$this->itemSelector;
41
-		if(isset($itemSelector) && $itemSelector!=="")
42
-			$selector.=" ".$itemSelector;
39
+		if(!isset($itemSelector)) {
40
+					$itemSelector=$this->itemSelector;
41
+		}
42
+		if(isset($itemSelector) && $itemSelector!=="") {
43
+					$selector.=" ".$itemSelector;
44
+		}
43 45
 		return $selector;
44 46
 	}
45 47
 
@@ -82,8 +84,9 @@  discard block
 block discarded – undo
82 84
 
83 85
 	protected function setParamCtrl($key, $value, $typeCtrl) {
84 86
 		if (\is_array($typeCtrl)) {
85
-			if (array_search($value, $typeCtrl)===false)
86
-				throw new \Exception("La valeur passée a propriété `".$key."` pour le composant `".$this->uiName."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}");
87
+			if (array_search($value, $typeCtrl)===false) {
88
+							throw new \Exception("La valeur passée a propriété `".$key."` pour le composant `".$this->uiName."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}");
89
+			}
87 90
 		} else {
88 91
 			if (!$typeCtrl($value)) {
89 92
 				throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$key." au composant ".$this->uiName);
Please login to merge, or discard this patch.
Ajax/semantic/widgets/base/InstanceViewer.php 1 patch
Braces   +42 added lines, -36 removed lines patch added patch discarded remove patch
@@ -23,8 +23,9 @@  discard block
 block discarded – undo
23 23
 		$this->widgetIdentifier=$identifier;
24 24
 		$this->values=[];
25 25
 		$this->afterCompile=[];
26
-		if(isset($instance))
27
-			$this->setInstance($instance);
26
+		if(isset($instance)) {
27
+					$this->setInstance($instance);
28
+		}
28 29
 		$this->setCaptions($captions);
29 30
 		$this->captionCallback=NULL;
30 31
 		$this->defaultValueFunction=function($name,$value){return $value;};
@@ -62,14 +63,16 @@  discard block
 block discarded – undo
62 63
 	}
63 64
 
64 65
 	public function getIdentifier($index=NULL){
65
-		if(!isset($index))
66
-			$index=self::$index;
66
+		if(!isset($index)) {
67
+					$index=self::$index;
68
+		}
67 69
 		$value=$index;
68 70
 		if(isset($this->values["identifier"])){
69
-			if(\is_string($this->values["identifier"]))
70
-				$value=JReflection::callMethod($this->instance, $this->values["identifier"], []);
71
-			else
72
-				$value=$this->values["identifier"]($index,$this->instance);
71
+			if(\is_string($this->values["identifier"])) {
72
+							$value=JReflection::callMethod($this->instance, $this->values["identifier"], []);
73
+			} else {
74
+							$value=$this->values["identifier"]($index,$this->instance);
75
+			}
73 76
 		}
74 77
 		return $value;
75 78
 	}
@@ -99,16 +102,16 @@  discard block
 block discarded – undo
99 102
 		if($property instanceof \ReflectionProperty){
100 103
 			$value=$this->_getPropertyValue($property, $index);
101 104
 			$propertyName=$property->getName();
102
-		}elseif(\is_callable($property))
103
-			$value=$property($this->instance);
104
-		elseif(\is_array($property)){
105
+		} elseif(\is_callable($property)) {
106
+					$value=$property($this->instance);
107
+		} elseif(\is_array($property)){
105 108
 			$values=\array_map(function($v) use ($index){return $this->_getValue($v, $index);}, $property);
106 109
 			$value=\implode("", $values);
107
-		}elseif(\is_string($property)){
110
+		} elseif(\is_string($property)){
108 111
 			$value=$property;
109 112
 			if(isset($this->instance->{$property})){
110 113
 				$value=$this->instance->{$property};
111
-			}elseif(\method_exists($this->instance, $getter=JReflection::getterName($property))){
114
+			} elseif(\method_exists($this->instance, $getter=JReflection::getterName($property))){
112 115
 				$value=JReflection::callMethod($this->instance, $getter, []);
113 116
 			}
114 117
 		}
@@ -118,7 +121,7 @@  discard block
 block discarded – undo
118 121
 	protected function _postGetValue($index,$propertyName,$value){
119 122
 		if(isset($this->values[$index])){
120 123
 			$value= $this->values[$index]($value,$this->instance,$index);
121
-		}else{
124
+		} else{
122 125
 			$value=$this->_getDefaultValue($propertyName,$value, $index);
123 126
 		}
124 127
 		if(isset($this->afterCompile[$index])){
@@ -139,10 +142,10 @@  discard block
 block discarded – undo
139 142
 		if(isset($vb[$index])){
140 143
 			if(\is_array($vb[$index])){
141 144
 				$this->visibleProperties[$index][]=$field;
142
-			}else{
145
+			} else{
143 146
 				$this->visibleProperties[$index]=[$vb[$index],$field];
144 147
 			}
145
-		}else{
148
+		} else{
146 149
 			return $this->insertField($index, $field);
147 150
 		}
148 151
 		return $this;
@@ -169,9 +172,9 @@  discard block
 block discarded – undo
169 172
 		$property=$this->getProperty($index);
170 173
 		if($property instanceof \ReflectionProperty){
171 174
 			$result=$property->getName();
172
-		}elseif(\is_callable($property)){
175
+		} elseif(\is_callable($property)){
173 176
 			$result=$this->visibleProperties[$index];
174
-		}else{
177
+		} else{
175 178
 			$result=$property;
176 179
 		}
177 180
 		return $result;
@@ -191,7 +194,7 @@  discard block
 block discarded – undo
191 194
 		$this->reflect=new \ReflectionClass($instance);
192 195
 		if(\sizeof($this->visibleProperties)===0){
193 196
 			$this->properties=$this->getDefaultProperties();
194
-		}else{
197
+		} else{
195 198
 			foreach ($this->visibleProperties as $property){
196 199
 				$this->setInstanceProperty($property);
197 200
 			}
@@ -202,22 +205,23 @@  discard block
 block discarded – undo
202 205
 	private function setInstanceProperty($property){
203 206
 		if(\is_callable($property)){
204 207
 			$this->properties[]=$property;
205
-		}elseif(\is_string($property)){
208
+		} elseif(\is_string($property)){
206 209
 			try{
207 210
 				$this->_beforeAddProperty(\sizeof($this->properties), $property);
208 211
 				$rProperty=$this->reflect->getProperty($property);
209 212
 				$this->properties[]=$rProperty;
210
-			}catch(\Exception $e){
213
+			} catch(\Exception $e){
211 214
 				$this->_beforeAddProperty(\sizeof($this->properties), $property);
212 215
 				$this->properties[]=$property;
213 216
 			}
214
-		}elseif(\is_int($property)){
217
+		} elseif(\is_int($property)){
215 218
 			$props=$this->getDefaultProperties();
216
-			if(isset($props[$property]))
217
-				$this->properties[]=$props[$property];
218
-				else
219
-					$this->properties[]=$property;
220
-		}else{
219
+			if(isset($props[$property])) {
220
+							$this->properties[]=$props[$property];
221
+			} else {
222
+									$this->properties[]=$property;
223
+				}
224
+		} else{
221 225
 			$this->properties[]=$property;
222 226
 		}
223 227
 	}
@@ -261,12 +265,13 @@  discard block
 block discarded – undo
261 265
 		if(isset($this->captions[$index])){
262 266
 			return $this->captions[$index];
263 267
 		}
264
-		if($this->properties[$index] instanceof \ReflectionProperty)
265
-			return $this->properties[$index]->getName();
266
-		elseif(\is_callable($this->properties[$index]))
267
-			return "";
268
-		else
269
-			return $this->properties[$index];
268
+		if($this->properties[$index] instanceof \ReflectionProperty) {
269
+					return $this->properties[$index]->getName();
270
+		} elseif(\is_callable($this->properties[$index])) {
271
+					return "";
272
+		} else {
273
+					return $this->properties[$index];
274
+		}
270 275
 	}
271 276
 
272 277
 	public function getCaptions(){
@@ -277,7 +282,7 @@  discard block
 block discarded – undo
277 282
 			for($i=$captionsSize;$i<$count;$i++){
278 283
 				$captions[]="";
279 284
 			}
280
-		}else{
285
+		} else{
281 286
 			$captions=[];
282 287
 			$index=0;
283 288
 			while($index<$count){
@@ -292,8 +297,9 @@  discard block
 block discarded – undo
292 297
 	}
293 298
 
294 299
 	public function setCaption($index,$caption){
295
-		if(isset($this->captions)===false)
296
-			$this->captions=[];
300
+		if(isset($this->captions)===false) {
301
+					$this->captions=[];
302
+		}
297 303
 		$this->captions[$index]=$caption;
298 304
 		return $this;
299 305
 	}
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/HtmlFormInput.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -9,16 +9,18 @@
 block discarded – undo
9 9
 	use TextFieldsTrait;
10 10
 
11 11
 	public function __construct($identifier, $label=NULL,$type="text",$value=NULL,$placeholder=NULL) {
12
-		if(!isset($placeholder) && $type==="text")
13
-			$placeholder=$label;
12
+		if(!isset($placeholder) && $type==="text") {
13
+					$placeholder=$label;
14
+		}
14 15
 		parent::__construct("field-".$identifier, new HtmlInput($identifier,$type,$value,$placeholder), $label);
15 16
 		$this->_identifier=$identifier;
16 17
 	}
17 18
 
18 19
 	public function getDataField(){
19 20
 		$field= $this->getField();
20
-		if($field instanceof HtmlInput)
21
-			$field=$field->getDataField();
21
+		if($field instanceof HtmlInput) {
22
+					$field=$field->getDataField();
23
+		}
22 24
 		return $field;
23 25
 	}
24 26
 }
Please login to merge, or discard this patch.
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");
@@ -140,12 +141,13 @@  discard block
 block discarded – undo
140 141
 	public function setColor($color){
141 142
 		if(\is_array($this->content)){
142 143
 			foreach ($this->content as $content){
143
-				if($content instanceof HtmlButton)
144
-					$content->setColor($color);
144
+				if($content instanceof HtmlButton) {
145
+									$content->setColor($color);
146
+				}
145 147
 			}
148
+		} else {
149
+					parent::setColor($color);
146 150
 		}
147
-		else
148
-			parent::setColor($color);
149 151
 		return $this;
150 152
 	}
151 153
 
@@ -198,8 +200,9 @@  discard block
 block discarded – undo
198 200
 	 * @return HtmlButton
199 201
 	 */
200 202
 	public static function social($identifier, $social, $value=NULL) {
201
-		if ($value === NULL)
202
-			$value=\ucfirst($social);
203
+		if ($value === NULL) {
204
+					$value=\ucfirst($social);
205
+		}
203 206
 		$return=new HtmlButton($identifier, $value);
204 207
 		$return->addIcon($social);
205 208
 		return $return->addToPropertyCtrl("class", $social, Social::getConstants());
Please login to merge, or discard this patch.
Ajax/semantic/html/modules/HtmlSearch.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -22,10 +22,12 @@
 block discarded – undo
22 22
 
23 23
 	private function createField($placeholder=NULL, $icon=NULL) {
24 24
 		$field=new HtmlInput($this->identifier);
25
-		if (isset($placeholder))
26
-			$field->setPlaceholder($placeholder);
27
-		if (isset($icon))
28
-			$field->addIcon($icon, Direction::RIGHT);
25
+		if (isset($placeholder)) {
26
+					$field->setPlaceholder($placeholder);
27
+		}
28
+		if (isset($icon)) {
29
+					$field->addIcon($icon, Direction::RIGHT);
30
+		}
29 31
 		$field->getDataField()->setClass("prompt");
30 32
 		$this->content["field"]=$field;
31 33
 		return $field;
Please login to merge, or discard this patch.