Code Duplication    Length = 12-12 lines in 2 locations

Ajax/semantic/widgets/base/FieldAsTrait.php 2 locations

@@ 63-74 (lines=12) @@
60
			return $this;
61
	}
62
63
	public function fieldAsInput($index,$name=NULL,$type="text",$placeholder=""){
64
		$this->setValueFunction($index,function($value) use($index,$name,$type,$placeholder){
65
			$input=new HtmlInput($this->_getFieldIdentifier("input"),$type,$value,$placeholder);
66
			if(isset($name)===false){
67
				$name=$this->_instanceViewer->getCaption($index)."[]";
68
			}
69
			$input->getField()->setProperty("name", $name);
70
			return $input;
71
		}
72
		);
73
			return $this;
74
	}
75
76
	public function fieldAsCheckbox($index,$name=NULL){
77
		$this->setValueFunction($index,function($value) use($index,$name){
@@ 76-87 (lines=12) @@
73
			return $this;
74
	}
75
76
	public function fieldAsCheckbox($index,$name=NULL){
77
		$this->setValueFunction($index,function($value) use($index,$name){
78
			$checkbox=new HtmlCheckbox($this->_getFieldIdentifier("ck"),"",$value);
79
			$checkbox->setChecked(JString::isBooleanTrue($value));
80
			if(isset($name)===false){
81
				$name=$this->_instanceViewer->getCaption($index)."[]";
82
			}
83
			$checkbox->getField()->setProperty("name", $name);
84
			return $checkbox;}
85
			);
86
			return $this;
87
	}
88
89
	public function fieldAsDropDown($index,$elements=[],$multiple=false,$name=NULL){
90
		$this->setValueFunction($index,function($value) use($index,$elements,$multiple,$name){