Code Duplication    Length = 12-13 lines in 2 locations

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

@@ 48-60 (lines=13) @@
45
			return $this;
46
	}
47
48
	public function fieldAsInput($index,$name=NULL,$type="text",$placeholder=""){
49
		$this->setValueFunction($index,function($value) use($index,$name,$type,$placeholder){
50
			$input=new HtmlInput($this->_getFieldIdentifier("input"),$type,$value,$placeholder);
51
			if(isset($name)===false){
52
				$name=$this->_instanceViewer->getCaption($index)."[]";
53
			}
54
			$input->getField()->setProperty("name", $name);
55
			$input->setFluid();
56
			return $input;
57
		}
58
		);
59
			return $this;
60
	}
61
62
	public function fieldAsCheckbox($index,$name=NULL){
63
		$this->setValueFunction($index,function($value) use($index,$name){
@@ 62-73 (lines=12) @@
59
			return $this;
60
	}
61
62
	public function fieldAsCheckbox($index,$name=NULL){
63
		$this->setValueFunction($index,function($value) use($index,$name){
64
			$checkbox=new HtmlCheckbox($this->_getFieldIdentifier("ck"),"",$value);
65
			$checkbox->setChecked(JString::isBooleanTrue($value));
66
			if(isset($name)===false){
67
				$name=$this->_instanceViewer->getCaption($index)."[]";
68
			}
69
			$checkbox->getField()->setProperty("name", $name);
70
			return $checkbox;}
71
			);
72
			return $this;
73
	}
74
75
	public function fieldAsDropDown($index,$elements=[],$multiple=false,$name=NULL){
76
		$this->setValueFunction($index,function($value) use($index,$elements,$multiple,$name){