Code Duplication    Length = 11-11 lines in 2 locations

Ajax/semantic/widgets/base/FieldAsTrait.php 1 location

@@ 52-62 (lines=11) @@
49
		return $label;
50
	}
51
52
	protected function _addRules($element,&$attributes){
53
		if(isset($attributes["rules"])){
54
			$rules=$attributes["rules"];
55
			if(\is_array($rules)){
56
				$element->addRules($rules);
57
			}
58
			else
59
				$element->addRule($rules);
60
				unset($attributes["rules"]);
61
		}
62
	}
63
64
	protected function _fieldAs($elementCallback,$index,$attributes=NULL,$prefix=null){
65
		$this->setValueFunction($index,function($value) use ($index,&$attributes,$elementCallback,$prefix){

Ajax/semantic/widgets/dataform/FormFieldAsTrait.php 1 location

@@ 30-40 (lines=11) @@
27
		return $label;
28
	}
29
30
	protected function _addRules($element,&$attributes){
31
		if(isset($attributes["rules"])){
32
			$rules=$attributes["rules"];
33
			if(\is_array($rules)){
34
				$element->addRules($rules);
35
			}
36
			else
37
				$element->addRule($rules);
38
			unset($attributes["rules"]);
39
		}
40
	}
41
42
	protected function _fieldAs($elementCallback,$index,$attributes=NULL,$prefix=null){
43
		$this->setValueFunction($index,function($value) use ($index,&$attributes,$elementCallback){