Slice the underlying collection array.

@param  int $offset
@param  int $length
@return CollectionInterface
@throws \InvalidArgumentException
357622
public function slice($offset, $length = null): CollectionInterface
    {
        if ($length < 0) {
            throw new InvalidArgumentException('Negative slice lengths are not supported');
        }

        $result = $this;
        if ($offset < 0) {
            $result = $this->take($offset);
        } elseif ($offset > 0) {
            $result = $this->offset($offset);
        }

        if ($length !== null) {
            $result = $result->take($length);
        }

        return $result;
    }
671456
public function slice($offset, $length = null)
    {
        $nodes = array_slice($this->_nodes, $offset, $length);
        return new SelectorList($this, $nodes);
    }
1164578
public function getSlice( $offset, $length, $params = array() )
    {
        $searchResult = $this->handler->search( $this->form, $this->criteriaBuilder, $this->resultConverter, $offset, $length, $params );
        if ( !isset( $this->nbResults ) )
        {
            $this->nbResults = $searchResult->totalCount;
        }

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

        $searchResult = $this->filterService->filterLocations($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;
        }

        if (!isset($this->facets) && isset($searchResult->facets)) {
            $this->facets = $searchResult->facets;
        }

        $list = [];
        foreach ($searchResult->searchHits as $hit) {
            $list[] = $hit->valueObject;
        }

        return $list;
    }
368179
public static function get($length = -1, int $offset = 0) : array
    {
        $ret     = [];
        $results = static::$_session->get("_RESULTS");

        if(
            !is_numeric($length)     &&
            isset($results[$length])
        ) {
            $ret = $results[$length]["result"];

            if($results[$length]["type"] === "flash") {
                unset($results[$length]);

                static::$_session->set("_RESULTS", $results);
            }

            return $ret;
        }

        foreach($results as $key => $value) {
            if($offset > 0) {
                $offset--;
                continue;
            }

            $ret[$key] = $$value["result"];

            if($value["type"] == "flash") {
                unset($results[$key]);
            }

            if($length-- == 0) {
                break;
            }
        }

        static::$_session->set("_RESULTS", $results);

        return $ret;
    }
1336283
function getMapList($length = -1, $offset = 0, $multicall = false)
    {
        if (!is_int($length)) {
            throw new InvalidArgumentException('length = ' . print_r($length, true));
        }
        if (!is_int($offset)) {
            throw new InvalidArgumentException('offset = ' . print_r($offset, true));
        }

        if ($multicall) {
            return $this->execute(ucfirst(__FUNCTION__), array($length, $offset), $this->structHandler('Map', true));
        }
        return Structures\Map::fromArrayOfArray($this->execute(ucfirst(__FUNCTION__), array($length, $offset)));
    }
605010
public function sliceAtoms($index, $length = null)
    {
        $atoms = $this->atoms();
        if (null === $length) {
            $length = count($atoms);
        }

        return array_slice($atoms, $index, $length);
    }
22602
public function slice($offset, $limit = null, $keys = true)
    {
        return new static(\array_slice($this->items, $offset, $limit, $keys));
    }
74537
public function slice(int $offset, int $length = null)
    {
        $actions = $this->internalDataListActions;
        $actions[] = ['slice', $offset, $length];
        $data = $this->internalDataListUpdateData($this->internalDataListData, $actions);
        $slice = array_slice($data, $offset, $length);
        $className = get_class($this);
        $list = new $className();
        foreach ($slice as $object) {
            $list->push($object);
        }
        return $list;
    }
1192817
public function slice($offset, $length = null)
    {
        $this->tags = array_slice($this->tags, $offset, $length, true);

        return $this;
    }
817457
public function offsetGet($offset)
    {
        $res = null;
        if(is_array($this->obj)){
            $res = &$this->obj[$offset];
        }elseif(self::hasProperty($this->obj, $offset)){
            $res = &$this->obj->{$offset};
        }elseif(method_exists($this->obj, 'get')){
            $res = $this->obj->get($offset);
        }elseif(method_exists($this->obj, $method = 'get'.ucfirst($offset))){
            $res = $this->obj->{$method}();
        }else{
            throw new \InvalidArgumentException("offsetGet($offset) failed");
        }
        if(is_array($res) || is_object($res)){
            return new self($res);
        }
        return $res;
    }
680178
public function cut(int $offset, ?int $length = null): self
    {
        if (null === $length) {
            $length = PHP_INT_MAX;
        }
        if ($offset < 0) {
            $offset = $this->count() + $offset;
        }

        return $this->prune(
            function ($value, $key, $index) use ($offset, $length) {
                return ($index >= $offset) && ($index < $offset + $length);
            }
        );
    }
105465
private function slice(array $rows, ?int $limit, ?int $offset) : array
    {
        if ($limit === null) {
            $limit = count($rows);
        }

        if ($offset === null) {
            $offset = 0;
        }

        return array_slice($rows, $offset, $limit);
    }
623909
public function getSlice($offset, $length): NotificationList
    {
        $notifications = $this->notificationService->loadNotifications($offset, $length);

        if (null === $this->nbResults) {
            $this->nbResults = $notifications->totalCount;
        }

        return $notifications;
    }
1197689
public function copyFrom(SplFixedArray $src, int $length = null, int $offset = null, int $srcOffset = null):ByteArray{
		$length    = $length ?? $src->count();
		$offset    = $offset ?? $length;
		$srcOffset = $srcOffset ?? 0;

		$diff = $offset + $length;

		if($diff > $this->count()){
			$this->setSize($diff);
		}

		for($i = 0; $i < $length; $i++){
			$this[$i + $offset] = $src[$i + $srcOffset];
		}

		return $this;
	}
1371518
public function read(int $length = 1, int $offset = 0) : string
    {
        return substr($this->getContent(), $offset, $length);
    }