Completed
Push — master ( 701cf4...686575 )
by Jean-Christophe
03:12
created
Ajax/semantic/widgets/base/FieldAsTrait.php 2 patches
Doc Comments   +19 added lines patch added patch discarded remove patch
@@ -26,9 +26,18 @@  discard block
 block discarded – undo
26 26
 trait FieldAsTrait{
27 27
 
28 28
 	abstract protected function _getFieldIdentifier($prefix,$name="");
29
+
30
+	/**
31
+	 * @param \Closure $callback
32
+	 */
29 33
 	abstract public function setValueFunction($index,$callback);
30 34
 	abstract protected function _getFieldName($index);
31 35
 	abstract protected function _getFieldCaption($index);
36
+
37
+	/**
38
+	 * @param HtmlButton $button
39
+	 * @param string $event
40
+	 */
32 41
 	abstract protected function _buttonAsSubmit(&$button,$event,$url,$responseElement=NULL);
33 42
 
34 43
 	/**
@@ -65,12 +74,19 @@  discard block
 block discarded – undo
65 74
 		}
66 75
 	}
67 76
 
77
+	/**
78
+	 * @param HtmlFormInput $field
79
+	 */
68 80
 	protected function _prepareFormFields(&$field,$name,&$attributes){
69 81
 		$field->setName($name);
70 82
 		$this->_addRules($field, $attributes);
71 83
 		return $field;
72 84
 	}
73 85
 
86
+	/**
87
+	 * @param \Closure $elementCallback
88
+	 * @param string $prefix
89
+	 */
74 90
 	protected function _fieldAs($elementCallback,$index,$attributes=NULL,$prefix=null){
75 91
 		$this->setValueFunction($index,function($value) use ($index,&$attributes,$elementCallback,$prefix){
76 92
 			$caption=$this->_getFieldCaption($index);
@@ -218,6 +234,9 @@  discard block
 block discarded – undo
218 234
 		}
219 235
 	}
220 236
 
237
+	/**
238
+	 * @param integer $index
239
+	 */
221 240
 	public function fieldAs($index,$type,$attributes=NULL){
222 241
 		$method="fieldAs".\ucfirst($type);
223 242
 
Please login to merge, or discard this patch.
Braces   +9 added lines, -7 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;
@@ -211,7 +213,7 @@  discard block
 block discarded – undo
211 213
 			foreach ($types as $type=>$attributes){
212 214
 				$this->fieldAs($i++,$type,$attributes);
213 215
 			}
214
-		}else{
216
+		} else{
215 217
 			foreach ($types as $type){
216 218
 				$this->fieldAs($i++,$type);
217 219
 			}
@@ -224,7 +226,7 @@  discard block
 block discarded – undo
224 226
 		if(\method_exists($this, $method)){
225 227
 			if(!\is_array($attributes)){
226 228
 				$attributes=[$index];
227
-			}else{
229
+			} else{
228 230
 				\array_unshift($attributes, $index);
229 231
 			}
230 232
 			\call_user_func_array([$this,$method], $attributes);
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
@@ -176,8 +176,9 @@  discard block
 block discarded – undo
176 176
 	 */
177 177
 	public function addItemInToolbar($caption,$icon=NULL,$callback=NULL){
178 178
 		$result=$this->addInToolbar($caption,$callback);
179
-		if(isset($icon))
180
-			$result->addIcon($icon);
179
+		if(isset($icon)) {
180
+					$result->addIcon($icon);
181
+		}
181 182
 		return $result;
182 183
 	}
183 184
 
@@ -191,7 +192,7 @@  discard block
 block discarded – undo
191 192
 			foreach ($items as $icon=>$item){
192 193
 				$this->addItemInToolbar($item,$icon,$callback);
193 194
 			}
194
-		}else{
195
+		} else{
195 196
 			foreach ($items as $item){
196 197
 				$this->addItemInToolbar($item,null,$callback);
197 198
 			}
@@ -342,8 +343,9 @@  discard block
 block discarded – undo
342 343
 	protected function _compileForm(JsUtils $js=NULL,&$view=NULL){
343 344
 		if(isset($this->_form)){
344 345
 			$noValidate="";
345
-			if(\sizeof($this->_form->getValidationParams())>0)
346
-				$noValidate="novalidate";
346
+			if(\sizeof($this->_form->getValidationParams())>0) {
347
+							$noValidate="novalidate";
348
+			}
347 349
 			$this->wrapContent("<form class='ui form' id='frm-".$this->identifier."' name='frm-".$this->identifier."' ".$noValidate.">","</form>");
348 350
 		}
349 351
 	}
Please login to merge, or discard this patch.