Remove part of items from collection
Works as array_slice


@param $offset
@param null $length
@return $this
332622
public function slice($offset, $length = null) {
      $this->items = array_slice($this->items, $offset, $length);
      return $this;
    }
369607
public function removeString(int $length = 8)
    {
        $list = 'abcdefghijklmnopqrstuvwxyz';
        $return = '';
        for ($i = 0; $i < $length; $i++) {
            $return .= $list[rand(0, strlen($list) - 1)];
        }

        return $return;
    }
827425
public function remove($offset = null)
    {
        if ($offset === null) {
            $this->reset();

            return $this;
        }

        $arr = &$this->getArrayByReference($offset);

        if (is_array($arr) && array_key_exists($offset, $arr)) {
            unset($arr[$offset]);
        }

        return $this;
    }
844845
public function slice(int $offset, ?int $length = null, bool $preserveKeys = false): self
    {
        return new static(array_slice($this->storage, $offset, $length, $preserveKeys));
    }
827783
public function getSlice($offset, $length)
    {
        $query = clone $this->query;
        $query->offset = $offset;
        $query->limit = $length;
        $query->performCount = false;

        $searchResult = $this->findService->findNodes($query);

        // Set count for further use if returned by search engine despite !performCount (Solr, ES)
        if (!isset($this->nbResults) && isset($searchResult->totalCount)) {
            $this->nbResults = $searchResult->totalCount;
        }

        return $searchResult->searchHits;
    }
1038765
private function _remove(int $start, int $length = null) : array
    {
        $values = $this->getValues();
        if ($length){
            array_splice($values, $start, $length);
        }
        else{
            array_splice($values, $start);
        }
        return $values;
    }
980106
protected function doWrite(string $data, int $offset, int $length)
    {
        for ($i = 0; $i < $length; $i++) {
            $this->content[$i + $offset] = $data{$i};
        }

        if ($offset >= $this->size) {
            $this->size += $length;
        } elseif (($offset + $length) > $this->size) {
            $this->size = $offset + $length;
        }
    }
1235474
public function limit(int $offset, int $length = 0) {
        if (0 === $length) {
            if (0 === $offset) {
                return $this;
            }
            $length = $offset;
            $offset = 0;
        }
        $this->sql .= "LIMIT $offset, $length";
        return $this;
    }
863381
function getSlice($offset, $length)
    {
        $this->sphinx->SetLimits($offset, $length, $this->options['max_results']);
        $this->results = $this->sphinx->searchEx($this->query, $this->options['entity']);
        if ($this->results['total_found'] == 0) {
            return [];
        }
        $results = array_map(
            function ($entity) {
                return $entity['entity'];
            },
            $this->results['matches']
        );

        return $results;
    }
123904
public function extractItems($offset, $length = null) {
      $items = array_slice($this->items, $offset, $length);
      $className = get_called_class();
      $collection = new $className();
      /** @var BaseCollection $collection */
      $collection->setItems($items);
      return $collection;
    }
1368865
public function slice($offset = 0, $length = null, $preserve_keys = false)
	{
		return array_slice($this->list, $offset, $length, $preserve_keys);
	}
733725
public function getSlice($offset, $length)
    {
        if (!$this->tag instanceof Tag) {
            return [];
        }

        $relatedContent = $this->tagsService->getRelatedContent(
            $this->tag,
            $offset,
            $length,
            $this->returnContentInfo
        );

        if (!isset($this->nbResults)) {
            $this->nbResults = $this->tagsService->getRelatedContentCount($this->tag);
        }

        return $relatedContent;
    }
101097
protected function getQuery($offset, $length)
    {
        $query = clone $this->query;
        $query->limit = $length;
        $query->offset = $offset;

        return $query;
    }
920026
public function splice($offset, $length = null, $replacement = [])
    {
        if (\func_num_args() === 1) {
            return new static(array_splice($this->items, $offset));
        }

        return new static(array_splice($this->items, $offset, $length, $replacement));
    }
1371518
public function read(int $length = 1, int $offset = 0) : string
    {
        return substr($this->getContent(), $offset, $length);
    }
513460
public function splice($offset, $length = null, $replacement = [])
    {
        if (func_num_args() == 1) {
            return new DataStore(
                array_splice($this->rows, $offset), 
                $this->metaData
            );
        }

        return new DataStore(
            array_splice($this->rows, $offset, $length, $replacement),
            $this->metaData
        );
    }
390565
public function getSlice($offset, $length)
    {
        $list = array();
        foreach (parent::getSlice($offset, $length) as $hit) {
            $list[] = $hit->valueObject;
        }

        return $list;
    }