Completed
Push — master ( 04d259...772d83 )
by Jean-Christophe
03:54
created
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/html/html5/HtmlInput.php 1 patch
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -17,8 +17,9 @@  discard block
 block discarded – undo
17 17
 	}
18 18
 
19 19
 	public function setValue($value) {
20
-		if(isset($value))
21
-		$this->setProperty("value", $value);
20
+		if(isset($value)) {
21
+				$this->setProperty("value", $value);
22
+		}
22 23
 		return $this;
23 24
 	}
24 25
 
@@ -27,16 +28,18 @@  discard block
 block discarded – undo
27 28
 	}
28 29
 
29 30
 	public function setPlaceholder($value){
30
-		if(JString::isNotNull($value))
31
-			$this->_placeholder=$value;
31
+		if(JString::isNotNull($value)) {
32
+					$this->_placeholder=$value;
33
+		}
32 34
 		return $this;
33 35
 	}
34 36
 
35 37
 	public function compile(JsUtils $js=NULL,&$view=NULL){
36 38
 		$value=$this->_placeholder;
37 39
 		if(JString::isNull($value)){
38
-			if(JString::isNotNull($this->getProperty("name")))
39
-				$value=\ucfirst($this->getProperty("name"));
40
+			if(JString::isNotNull($this->getProperty("name"))) {
41
+							$value=\ucfirst($this->getProperty("name"));
42
+			}
40 43
 		}
41 44
 		$this->setProperty("placeholder", $value);
42 45
 		return parent::compile($js,$view);
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
@@ -186,8 +186,9 @@  discard block
 block discarded – undo
186 186
 	 */
187 187
 	public function addItemInToolbar($caption,$icon=NULL,$callback=NULL){
188 188
 		$result=$this->addInToolbar($caption,$callback);
189
-		if(isset($icon))
190
-			$result->addIcon($icon);
189
+		if(isset($icon)) {
190
+					$result->addIcon($icon);
191
+		}
191 192
 		return $result;
192 193
 	}
193 194
 
@@ -201,7 +202,7 @@  discard block
 block discarded – undo
201 202
 			foreach ($items as $icon=>$item){
202 203
 				$this->addItemInToolbar($item,$icon,$callback);
203 204
 			}
204
-		}else{
205
+		} else{
205 206
 			foreach ($items as $item){
206 207
 				$this->addItemInToolbar($item,null,$callback);
207 208
 			}
@@ -352,8 +353,9 @@  discard block
 block discarded – undo
352 353
 	protected function _compileForm(){
353 354
 		if(isset($this->_form)){
354 355
 			$noValidate="";
355
-			if(\sizeof($this->_form->getValidationParams())>0)
356
-				$noValidate="novalidate";
356
+			if(\sizeof($this->_form->getValidationParams())>0) {
357
+							$noValidate="novalidate";
358
+			}
357 359
 			$this->wrapContent("<form class='ui form' id='frm-".$this->identifier."' name='frm-".$this->identifier."' ".$noValidate.">","</form>");
358 360
 		}
359 361
 	}
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/HtmlForm.php 1 patch
Braces   +25 added lines, -17 removed lines patch added patch discarded remove patch
@@ -52,8 +52,9 @@  discard block
 block discarded – undo
52 52
 	 */
53 53
 	public function addHeader($title, $niveau=1, $dividing=true) {
54 54
 		$header=new HtmlHeader("", $niveau, $title);
55
-		if ($dividing)
56
-			$header->setDividing();
55
+		if ($dividing) {
56
+					$header->setDividing();
57
+		}
57 58
 		return $this->addItem($header);
58 59
 	}
59 60
 
@@ -74,14 +75,16 @@  discard block
 block discarded – undo
74 75
 					if (\is_string($end)) {
75 76
 						$label=$end;
76 77
 						\array_pop($fields);
77
-					} else
78
-						$label=NULL;
78
+					} else {
79
+											$label=NULL;
80
+					}
79 81
 				}
80 82
 				$this->_fields=\array_merge($this->_fields, $fields);
81 83
 				$fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count(), $fields);
82 84
 			}
83
-			if (isset($label))
84
-				$fields=new HtmlFormField("", $fields, $label);
85
+			if (isset($label)) {
86
+							$fields=new HtmlFormField("", $fields, $label);
87
+			}
85 88
 		} else {
86 89
 			$fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count());
87 90
 		}
@@ -134,27 +137,31 @@  discard block
 block discarded – undo
134 137
 	 */
135 138
 	public function addMessage($identifier, $content, $header=NULL, $icon=NULL, $type=NULL) {
136 139
 		$message=new HtmlMessage($identifier, $content);
137
-		if (isset($header))
138
-			$message->addHeader($header);
139
-		if (isset($icon))
140
-			$message->setIcon($icon);
141
-		if (isset($type))
142
-			$message->setStyle($type);
140
+		if (isset($header)) {
141
+					$message->addHeader($header);
142
+		}
143
+		if (isset($icon)) {
144
+					$message->setIcon($icon);
145
+		}
146
+		if (isset($type)) {
147
+					$message->setStyle($type);
148
+		}
143 149
 		return $this->addItem($message);
144 150
 	}
145 151
 
146 152
 
147 153
 
148 154
 	public function compile(JsUtils $js=NULL,&$view=NULL){
149
-		if(\sizeof($this->_validationParams)>0)
150
-			$this->setProperty("novalidate", "");
155
+		if(\sizeof($this->_validationParams)>0) {
156
+					$this->setProperty("novalidate", "");
157
+		}
151 158
 		return parent::compile($js,$view);
152 159
 	}
153 160
 
154 161
 	public function run(JsUtils $js) {
155 162
 		if(isset($js)){
156 163
 			$compo=$js->semantic()->form("#".$this->identifier);
157
-		}else{
164
+		} else{
158 165
 			$compo=new Form();
159 166
 			$compo->attach("#".$this->identifier);
160 167
 		}
@@ -167,8 +174,9 @@  discard block
 block discarded – undo
167 174
 			if($field instanceof HtmlFormFields){
168 175
 				$items=$field->getItems();
169 176
 				foreach ($items as $_field){
170
-					if($_field instanceof HtmlFormField)
171
-						$compo=$this->addCompoValidation($compo, $_field);
177
+					if($_field instanceof HtmlFormField) {
178
+											$compo=$this->addCompoValidation($compo, $_field);
179
+					}
172 180
 				}
173 181
 			}
174 182
 		}
Please login to merge, or discard this patch.
Ajax/semantic/widgets/base/FieldAsTrait.php 1 patch
Braces   +14 added lines, -11 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;
@@ -209,12 +211,13 @@  discard block
 block discarded – undo
209 211
 		$i=0;
210 212
 		if(JArray::isAssociative($types)){
211 213
 			foreach ($types as $type=>$attributes){
212
-				if(\is_int($type))
213
-					$this->fieldAs($i++,$attributes,[]);
214
-				else
215
-					$this->fieldAs($i++,$type,$attributes);
214
+				if(\is_int($type)) {
215
+									$this->fieldAs($i++,$attributes,[]);
216
+				} else {
217
+									$this->fieldAs($i++,$type,$attributes);
218
+				}
216 219
 			}
217
-		}else{
220
+		} else{
218 221
 			foreach ($types as $type){
219 222
 				$this->fieldAs($i++,$type);
220 223
 			}
@@ -226,7 +229,7 @@  discard block
 block discarded – undo
226 229
 		if(\method_exists($this, $method)){
227 230
 			if(!\is_array($attributes)){
228 231
 				$attributes=[$index];
229
-			}else{
232
+			} else{
230 233
 				\array_unshift($attributes, $index);
231 234
 			}
232 235
 			\call_user_func_array([$this,$method], $attributes);
Please login to merge, or discard this patch.
Ajax/semantic/html/base/traits/BaseTrait.php 1 patch
Braces   +21 added lines, -14 removed lines patch added patch discarded remove patch
@@ -45,8 +45,9 @@  discard block
 block discarded – undo
45 45
 
46 46
 	public function setVariations($variations) {
47 47
 		$this->setProperty("class", $this->_baseClass);
48
-		if (\is_string($variations))
49
-			$variations=\explode(" ", $variations);
48
+		if (\is_string($variations)) {
49
+					$variations=\explode(" ", $variations);
50
+		}
50 51
 		foreach ( $variations as $variation ) {
51 52
 			$this->addVariation($variation);
52 53
 		}
@@ -59,8 +60,9 @@  discard block
 block discarded – undo
59 60
 	}
60 61
 
61 62
 	public function addVariations($variations=array()) {
62
-		if (\is_string($variations))
63
-			$variations=\explode(" ", $variations);
63
+		if (\is_string($variations)) {
64
+					$variations=\explode(" ", $variations);
65
+		}
64 66
 		foreach ( $variations as $variation ) {
65 67
 			$this->addVariation($variation);
66 68
 		}
@@ -68,8 +70,9 @@  discard block
 block discarded – undo
68 70
 	}
69 71
 
70 72
 	public function addStates($states=array()) {
71
-		if (\is_string($states))
72
-			$states=\explode(" ", $states);
73
+		if (\is_string($states)) {
74
+					$states=\explode(" ", $states);
75
+		}
73 76
 		foreach ( $states as $state ) {
74 77
 			$this->addState($state);
75 78
 		}
@@ -78,8 +81,9 @@  discard block
 block discarded – undo
78 81
 
79 82
 	public function setStates($states) {
80 83
 		$this->setProperty("class", $this->_baseClass);
81
-		if (\is_string($states))
82
-			$states=\explode(" ", $states);
84
+		if (\is_string($states)) {
85
+					$states=\explode(" ", $states);
86
+		}
83 87
 		foreach ( $states as $state ) {
84 88
 			$this->addState($state);
85 89
 		}
@@ -111,8 +115,9 @@  discard block
 block discarded – undo
111 115
 	 * @return \Ajax\semantic\html\elements\HtmlSemDoubleElement
112 116
 	 */
113 117
 	public function setDisabled($disable=true) {
114
-		if($disable)
115
-			$this->addToProperty("class", "disabled");
118
+		if($disable) {
119
+					$this->addToProperty("class", "disabled");
120
+		}
116 121
 		return $this;
117 122
 	}
118 123
 
@@ -146,14 +151,16 @@  discard block
 block discarded – undo
146 151
 	 * @return \Ajax\semantic\html\base\HtmlSemDoubleElement
147 152
 	 */
148 153
 	public function setActive($value=true){
149
-		if($value)
150
-			$this->addToProperty("class", "active");
154
+		if($value) {
155
+					$this->addToProperty("class", "active");
156
+		}
151 157
 		return $this;
152 158
 	}
153 159
 
154 160
 	public function setAttached($value=true){
155
-		if($value)
156
-			$this->addToPropertyCtrl("class", "attached", array ("attached" ));
161
+		if($value) {
162
+					$this->addToPropertyCtrl("class", "attached", array ("attached" ));
163
+		}
157 164
 		return $this;
158 165
 	}
159 166
 
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/traits/FormTrait.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -42,8 +42,9 @@  discard block
 block discarded – undo
42 42
 
43 43
 	public function setAttached($value=true){
44 44
 		$form=$this->getForm();
45
-		if($value)
46
-			$form->addToPropertyCtrl("class", "attached", array ("attached" ));
45
+		if($value) {
46
+					$form->addToPropertyCtrl("class", "attached", array ("attached" ));
47
+		}
47 48
 		return $form;
48 49
 	}
49 50
 
@@ -85,8 +86,9 @@  discard block
 block discarded – undo
85 86
 		if(isset($url) && isset($responseElement)){
86 87
 			$button->addEvent($event, "$('#".$form->getIdentifier()."').form('validate form');");
87 88
 			$params=["form"=>$form->getIdentifier(),"responseElement"=>$responseElement,"url"=>$url];
88
-			if(\is_array($parameters))
89
-				$params=\array_merge($params,$parameters);
89
+			if(\is_array($parameters)) {
90
+							$params=\array_merge($params,$parameters);
91
+			}
90 92
 			$form->addValidationParam("_ajaxSubmit", new AjaxCall("postForm", $params));
91 93
 		}
92 94
 		return $button;
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/table/traits/TableTrait.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -17,15 +17,17 @@
 block discarded – undo
17 17
 
18 18
 	public function setBasic($very=false) {
19 19
 		$table=$this->getTable();
20
-		if ($very)
21
-			$table->addToPropertyCtrl("class", "very", array ("very" ));
20
+		if ($very) {
21
+					$table->addToPropertyCtrl("class", "very", array ("very" ));
22
+		}
22 23
 		return $table->addToPropertyCtrl("class", "basic", array ("basic" ));
23 24
 	}
24 25
 
25 26
 	public function setCompact($very=false) {
26 27
 		$table=$this->getTable();
27
-		if ($very)
28
-			$table->addToPropertyCtrl("class", "very", array ("very" ));
28
+		if ($very) {
29
+					$table->addToPropertyCtrl("class", "very", array ("very" ));
30
+		}
29 31
 		return $table->addToPropertyCtrl("class", "compact", array ("compact" ));
30 32
 	}
31 33
 
Please login to merge, or discard this patch.
Ajax/semantic/widgets/base/InstanceViewer.php 1 patch
Braces   +42 added lines, -37 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
 
@@ -67,22 +70,21 @@  discard block
 block discarded – undo
67 70
 			$value=$property->getValue($this->instance);
68 71
 			if(isset($this->values[$index])){
69 72
 				$value= $this->values[$index]($value,$this->instance,$index);
70
-			}else{
73
+			} else{
71 74
 				$value=$this->_getDefaultValue($property->getName(),$value, $index);
72 75
 			}
73
-		}else{
74
-			if(\is_callable($property))
75
-				$value=$property($this->instance);
76
-			elseif(\is_array($property)){
76
+		} else{
77
+			if(\is_callable($property)) {
78
+							$value=$property($this->instance);
79
+			} elseif(\is_array($property)){
77 80
 				$values=\array_map(function($v) use ($index){return $this->_getValue($v, $index);}, $property);
78 81
 				$value=\implode("", $values);
79
-			}else{
82
+			} else{
80 83
 				if(isset($this->values[$index])){
81 84
 					$value= $this->values[$index]($property,$this->instance,$index);
82
-				}elseif(isset($this->instance->{$property})){
85
+				} elseif(isset($this->instance->{$property})){
83 86
 					$value=$this->instance->{$property};
84
-				}
85
-				else{
87
+				} else{
86 88
 					$value=null;
87 89
 				}
88 90
 			}
@@ -105,10 +107,10 @@  discard block
 block discarded – undo
105 107
 		if(isset($vb[$index])){
106 108
 			if(\is_array($vb[$index])){
107 109
 				$this->visibleProperties[$index][]=$field;
108
-			}else{
110
+			} else{
109 111
 				$this->visibleProperties[$index]=[$vb[$index],$field];
110 112
 			}
111
-		}else{
113
+		} else{
112 114
 			return $this->insertField($index, $field);
113 115
 		}
114 116
 		return $this;
@@ -135,9 +137,9 @@  discard block
 block discarded – undo
135 137
 		$property=$this->getProperty($index);
136 138
 		if($property instanceof \ReflectionProperty){
137 139
 			$result=$property->getName();
138
-		}elseif(\is_callable($property)){
140
+		} elseif(\is_callable($property)){
139 141
 			$result=$this->visibleProperties[$index];
140
-		}else{
142
+		} else{
141 143
 			$result=$property;
142 144
 		}
143 145
 		return $result;
@@ -157,7 +159,7 @@  discard block
 block discarded – undo
157 159
 		$this->reflect=new \ReflectionClass($instance);
158 160
 		if(\sizeof($this->visibleProperties)===0){
159 161
 			$this->properties=$this->getDefaultProperties();
160
-		}else{
162
+		} else{
161 163
 			foreach ($this->visibleProperties as $property){
162 164
 				$this->setInstanceProperty($property);
163 165
 			}
@@ -168,22 +170,23 @@  discard block
 block discarded – undo
168 170
 	private function setInstanceProperty($property){
169 171
 		if(\is_callable($property)){
170 172
 			$this->properties[]=$property;
171
-		}elseif(\is_string($property)){
173
+		} elseif(\is_string($property)){
172 174
 			try{
173 175
 				$this->_beforeAddProperty(\sizeof($this->properties), $property);
174 176
 				$rProperty=$this->reflect->getProperty($property);
175 177
 				$this->properties[]=$rProperty;
176
-			}catch(\Exception $e){
178
+			} catch(\Exception $e){
177 179
 				$this->_beforeAddProperty(\sizeof($this->properties), $property);
178 180
 				$this->properties[]=$property;
179 181
 			}
180
-		}elseif(\is_int($property)){
182
+		} elseif(\is_int($property)){
181 183
 			$props=$this->getDefaultProperties();
182
-			if(isset($props[$property]))
183
-				$this->properties[]=$props[$property];
184
-				else
185
-					$this->properties[]=$property;
186
-		}else{
184
+			if(isset($props[$property])) {
185
+							$this->properties[]=$props[$property];
186
+			} else {
187
+									$this->properties[]=$property;
188
+				}
189
+		} else{
187 190
 			$this->properties[]=$property;
188 191
 		}
189 192
 	}
@@ -227,12 +230,13 @@  discard block
 block discarded – undo
227 230
 		if(isset($this->captions[$index])){
228 231
 			return $this->captions[$index];
229 232
 		}
230
-		if($this->properties[$index] instanceof \ReflectionProperty)
231
-			return $this->properties[$index]->getName();
232
-		elseif(\is_callable($this->properties[$index]))
233
-			return "";
234
-		else
235
-			return $this->properties[$index];
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];
239
+		}
236 240
 	}
237 241
 
238 242
 	public function getCaptions(){
@@ -241,7 +245,7 @@  discard block
 block discarded – undo
241 245
 			for($i=\sizeof($captions);$i<$this->count();$i++){
242 246
 				$captions[]="";
243 247
 			}
244
-		}else{
248
+		} else{
245 249
 			$captions=[];
246 250
 			$index=0;
247 251
 			$count=$this->count();
@@ -257,8 +261,9 @@  discard block
 block discarded – undo
257 261
 	}
258 262
 
259 263
 	public function setCaption($index,$caption){
260
-		if(isset($this->captions)===false)
261
-			$this->captions=[];
264
+		if(isset($this->captions)===false) {
265
+					$this->captions=[];
266
+		}
262 267
 		$this->captions[$index]=$caption;
263 268
 		return $this;
264 269
 	}
Please login to merge, or discard this patch.