Returns a slice of the collection starting at the given index. Returns a new Collection.
@param int      $offset
@param int      $limit
@param bool     $preserve_keys
@return \CharlotteDunois\Collect\Collection
555848
function slice(int $offset, int $limit = null, bool $preserve_keys = false) {
        $data = $this->data;
        return (new self(\array_slice($data, $offset, $limit, $preserve_keys)));
    }
774904
protected function switchPersisterContext($offset, $limit)
    {
        if (null === $offset && null === $limit) {
            $this->currentPersisterContext = $this->noLimitsContext;

            return;
        }

        $this->currentPersisterContext = $this->limitsHandlingContext;
    }
793499
public function limit($offset, $limit)
	{
		$sql = (string) $this->data_source;

		$result = $this->data_source->getConnection()
			->query('%sql OFFSET ? ROWS FETCH NEXT ? ROWS ONLY', $sql, $offset, $limit);

		$this->data = $result->fetchAll();

		return $this;
	}
248861
public function getFields($offset = 0, $limit = 100)
	{
		$fields = [];
		foreach ($this->client->get("fields?offset={$offset}&limit={$limit}") as $field) {
			$fields[] = new Resources\Field($this, $field);
		}
		return $fields;
	}
358055
public function getSortedSets($key, $start = 0, $limit = 20, $with_scores = true)
    {
        return $this->getSortedSetsAsc($key, $start, $limit, $with_scores);
    }
681041
public function clientListDb($offset = null, $limit = null)
  {
    return $this->execute("clientdblist -count", array("start" => $offset, "duration" => $limit))->toAssocArray("cldbid");
  }
1284811
public function prepareLimit($limit, $offset = null)
    {
        if ($offset) {
            $this->setLimit = ' LIMIT ' . $limit . ', ' . $offset . '';
        } else {
            $this->setLimit = ' LIMIT ' . $limit . '';
        }

        return $this;
    }
634867
public function getItems($offset, $limit)
    {
        $query = $this->search->getQuery();
        $query->setFrom($offset);
        $query->setSize($limit);

        return $this->search->search()->getResults();
    }
701616
public function slice($offset = 0, $length = null, $preserve_keys = false)
        {
            $array = array_slice($this->get(), $offset, $length, $preserve_keys);
            $this->update($array);
            return $this;
        }
790304
protected function fetch($limit = null, $offset = null)
    {
        if (is_int($limit)) {
            $this->statement->limit($limit, $offset);
        }

        $statement = $this->statement->execute();

        if ($this->model instanceof Models) {
            $statement->setFetchMode(\PDO::FETCH_INTO, $this->model);
        } else {
            $statement->setFetchMode(\PDO::FETCH_CLASS|\PDO::FETCH_PROPS_LATE, $this->model);
        }

        return $statement;
    }
1107907
protected function queryLimitOffset($query, $limit = null, $offset = 0)
    {
        $limit  = $limit ?: $this->limit;
        $offset = $offset ?: $this->offset;

        if ($limit) {
            $query->take($limit)->skip($offset);
        }

        return $query;
    }
1263130
public function find(callable $callback, $keepKey = false, $offset = null, $limit = null)
    {
        return $this->bindNewInstance(Arr::find($this->convertArray($this), $callback, $keepKey, $offset, $limit));
    }
1012141
public function getList($limit, $offset = 0)
    {
        return $this->getEntityManager()->createQuery('
            SELECT
                n
            FROM
                AnimeDbAppBundle:Notice n
            ORDER BY
                n.date_created DESC
        ')
            ->setFirstResult($offset)
            ->setMaxResults($limit)
            ->getResult();
    }
1210626
public function limit($offset, $limit)
	{
		$this->data_source = $this->data_source->limitBy($limit, $offset);

		return $this;
	}
631416
final public function limit($limit,$offset=null) {
      if (is_numeric($limit) || is_array($limit)) {
         if(is_array($limit)) {
            $temp   = $limit;
            $limit  =  $temp[0];
            $offset = @$temp[1];
         }

         $this->limit = " LIMIT {$limit} ";

         if(is_numeric($offset)) {
            $this->offset( $offset );
         }
         $this->find_first_data = $this->find_save_data = $this->find_delete_data = FALSE;

         $this->get_instance();
         return $this;
      }

      return null;
   }
401917
public function limit($limit, $offset = null)
    {
        $self              = self::getInstance();
        $offset            = (!empty($offset)) ? 'OFFSET '.$offset : null;
        $self->optionLimit = " LIMIT {$limit} ".$offset;

        return $self;
    }
812891
public function getItems($offset, $limit) {
		if ($this->_data === null) {
			throw new RuntimeException('Wasn\'t data been provided');
		}
		
		$items = array_slice($this->_data, $offset, $limit);
		
		if ($this->_wrapIntoCollection) {
			return new Collection($items, $this->_modelClass, $this->_primary);
		} else {
			return new ArrayIterator($items);
		}
	}