Code Duplication    Length = 11-12 lines in 2 locations

Ajax/common/html/HtmlCollection.php 1 location

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

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

@@ 146-156 (lines=11) @@
143
		return $this->addItem(HtmlDropdownItem::avatar($caption, $image));
144
	}
145
146
	public function addItems($items){
147
		if(JArray::isAssociative($items)){
148
			foreach ($items as $k=>$v){
149
				$this->addItem($v)->setData($k);
150
			}
151
		}else{
152
			foreach ($items as $item){
153
				$this->addItem($item);
154
			}
155
		}
156
	}
157
158
	public function getItem($index){
159
		return $this->items[$index];