private function getResultItem($item) { $result = new Result(count($this->items), $item); foreach ($this->items as $i => $index) { $pos = $index->getPosition($item); if (!is_null($pos)) { $result->position($i, $pos); } } return $result; }
public function getSplitedItems() { $sum = array(); foreach ($this->positions as $position => $cmp) { if (!isset($sum[$cmp])) { $sum[$cmp] = array(); } $sum[$cmp][] = $position; } $result = array(); foreach ($sum as $positions) { $item = new Result($this->item->getLength(), $this->item->getItem()); foreach ($positions as $position) { $pos = $this->item->getPosition($position); if (!is_null($pos)) { $item->position($position, $pos); } } $result[] = $item; } return $result; }