Code Duplication    Length = 11-12 lines in 2 locations

Ajax/common/html/HtmlCollection.php 1 location

@@ 21-32 (lines=12) @@
18
		$this->content=array();
19
	}
20
21
	public function addItems($items){
22
		if(JArray::isAssociative($items)){
23
			foreach ($items as $k=>$v){
24
				$this->addItem([$k,$v]);
25
			}
26
		}else{
27
			foreach ($items as $item){
28
				$this->addItem($item);
29
			}
30
		}
31
		return $this;
32
	}
33
34
	public function setItems($items){
35
		$this->content=$items;

Ajax/semantic/html/modules/HtmlDropdown.php 1 location

@@ 140-150 (lines=11) @@
137
		return $this->addItem(HtmlDropdownItem::avatar($caption, $image));
138
	}
139
140
	public function addItems($items){
141
		if(JArray::isAssociative($items)){
142
			foreach ($items as $k=>$v){
143
				$this->addItem($v)->setData($k);
144
			}
145
		}else{
146
			foreach ($items as $item){
147
				$this->addItem($item);
148
			}
149
		}
150
	}
151
152
	/**
153
	 * @return int