Code Duplication    Length = 12-13 lines in 2 locations

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

@@ 96-107 (lines=12) @@
93
			return $this;
94
	}
95
96
	public function fieldAsInput($index,$attributes=NULL){
97
		$this->setValueFunction($index,function($value) use($index,$attributes){
98
			$input=new HtmlInput($this->_getFieldIdentifier("input"),"text",$value);
99
			if(isset($attributes["name"])===false){
100
				$attributes["name"]=$this->_instanceViewer->getCaption($index)."[]";
101
			}
102
			$input->getField()->setProperty("name", $attributes["name"]);
103
			$this->_applyAttributes($input, $attributes, $index);
104
			return $input;
105
		});
106
			return $this;
107
	}
108
109
	public function fieldAsCheckbox($index,$attributes=NULL){
110
		$this->setValueFunction($index,function($value) use($index,$attributes){
@@ 109-121 (lines=13) @@
106
			return $this;
107
	}
108
109
	public function fieldAsCheckbox($index,$attributes=NULL){
110
		$this->setValueFunction($index,function($value) use($index,$attributes){
111
			$checkbox=new HtmlCheckbox($this->_getFieldIdentifier("ck"),"",$value);
112
			$checkbox->setChecked(JString::isBooleanTrue($value));
113
			if(isset($attributes["name"])===false){
114
				$attributes["name"]=$this->_instanceViewer->getCaption($index)."[]";
115
			}
116
			$checkbox->getField()->setProperty("name", $attributes["name"]);
117
			$this->_applyAttributes($checkbox, $attributes, $index);
118
			return $checkbox;
119
		});
120
			return $this;
121
	}
122
123
	public function fieldAsDropDown($index,$elements=[],$multiple=false,$attributes=NULL){
124
		$this->setValueFunction($index,function($value) use($index,$elements,$multiple,$attributes){