Returns an result set of items for a page

@param  int $offset Page offset
@param  int $itemCountPerPage Number of items per page
@return HydratingResultSet
775408
public function getItems($offset, $itemCountPerPage)
    {
        $cacheKey = $offset . '-' . $itemCountPerPage;

        if (isset($this->preloadCache[$cacheKey])) {
            return $this->preloadCache[$cacheKey];
        }

        return $this->loadItems($offset, $itemCountPerPage);
    }
588134
public function offsetGet($offset)
    {
        return $this->offsetExists($offset) ? array_get($this->items, $offset) : null;
    }
351238
public function setItemsPerPage(int $itemsPerPage = null)
    {
        return $this
            ->pagination
            ->setItemsPerPage(
                $this->pagination->getItemsPerPage()
            );
    }
1102971
public static function getTwoTablePagination(int $table1Count, int $table2Count, int $limit, int $offset = 0): array
    {
        \assert('$table1Count >= 0 && $table2Count >= 0 && $limit >= 0 && $offset >= 0');
        $offset1 = min($offset, $table1Count);
        $limit1 = min($limit, $table1Count - $offset1);
        $offset2 = min($offset - $offset1, $table2Count);
        $limit2 = min($limit - $limit1, $table2Count - $offset2);
        return [
            'limit1' => $limit1,
            'offset1' => $offset1,
            'limit2' => $limit2,
            'offset2' => $offset2,
        ];
    }
126129
public function paginate(Builder $builder, $perPage, $page)
    {
        $results = $this->performSearch($builder);

        if ($builder->limit) {
            $results['hits'] = $builder->limit;
        }

        $filtered = $this->discardIdsFromResultSetByConstraints($builder, $results['ids']);

        $results['hits'] = $filtered->count();

        $chunks = array_chunk($filtered->toArray(), $perPage);

        if (empty($chunks)) {
            return $results;
        }

        if (array_key_exists($page - 1, $chunks)) {
            $results['ids'] = $chunks[$page - 1];
        } else {
            $results['ids'] = end($chunks);
        }

        return $results;
    }
337840
public function getBuckets($page = null, $perPage = null, $data = [])
    {
        $oDb = Factory::service('Database');
        $oDb->select('b.id,b.slug,b.label,b.allowed_types,b.max_size,b.created,b.created_by');
        $oDb->select('b.modified,b.modified_by');

        //  Apply common items; pass $data
        $this->getCountCommonBuckets($data);

        // --------------------------------------------------------------------------

        //  Facilitate pagination
        if (!is_null($page)) {

            /**
             * Adjust the page variable, reduce by one so that the offset is calculated
             * correctly. Make sure we don't go into negative numbers
             */

            $page--;
            $page = $page < 0 ? 0 : $page;

            //  Work out what the offset should be
            $perPage = is_null($perPage) ? 50 : (int) $perPage;
            $offset  = $page * $perPage;

            $oDb->limit($perPage, $offset);
        }

        // --------------------------------------------------------------------------

        $buckets    = $oDb->get(NAILS_DB_PREFIX . 'cdn_bucket b')->result();
        $numBuckets = count($buckets);

        for ($i = 0; $i < $numBuckets; $i++) {

            //  Format the object, make it pretty
            $this->formatBucket($buckets[$i]);
        }

        return $buckets;
    }
837968
public function get($page, $pageSize, $websiteId = null, $storeId = null)
    {
        $this
            ->initCollection()
            ->filterMixedParam($websiteId, 'website_id')
            ->filterMixedParam($storeId, 'store_id')
            ->joinAddress('billing')
            ->joinAddress('shipping')
            ->joinSubscriptionStatus()
            ->setPage($page, $pageSize);

        return $this->customersResponseFactory->create()
            ->setCurrentPage($this->customerCollection->getCurPage())
            ->setLastPage($this->customerCollection->getLastPageNumber())
            ->setPageSize($this->customerCollection->getPageSize())
            ->setTotalCount($this->customerCollection->getSize())
            ->setCustomers($this->handleCustomers());
    }
859324
public function getPaginatedEntities(array $options = [], $hydrationMode = AbstractQuery::HYDRATE_OBJECT)
    {
        $options = PaginatedEntityRepositoryOptionsResolver::createAndResolve($options);
        $queryBuilder = $this->addPagination(
            $this->getQueryBuilder($options['filters'], $options['sorting']),
            $options['elementsPerPage'],
            $options['page']
        );

        return new Paginator($queryBuilder->getQuery()->setHydrationMode($hydrationMode));
    }
944868
public static function paginated($perPage, $item = [], $options = [], $query = null)
    {
        $request = new Request();

        if (is_null($query)) {
            $query = 'page';
        }

        if (!count($item)) {
            $item = static::all();
        }

        $currentPage = $request->input($query, null);
        if (is_null($currentPage)) {
            $currentPage = 1;
        }

        $collection = new Collection($item);
        $currentPageResults = $collection->slice(($currentPage - 1) * $perPage, $perPage)->all();

        if (!isset($options['path'])) {
            $options['path'] = $request->path();
        }

        return new Paginator(
            $currentPageResults, count($collection), $perPage, $currentPage, $options
        );
    }
1327499
public function findAllPaginated($offset = null, $limit = null)
    {
        $qb = $this
            ->createQueryBuilder('w')
            ->orderBy('w.id')
            ->setMaxResults($limit);
        if ($offset) {
            $qb->setFirstResult($offset);
        }

        return $qb->getQuery()->getResult();
    }
105420
public function item($offset)
  {
    if (isset($this->formulae[$offset])) {
      $item = $this->formulae[$offset];
    } else {
      $item = null;
    }
    return $item;
  }
909965
public function & offsetGet( $offset )
	{
		if( ! isset($this->items[$offset]) )
		{
			$value = null;
		}

		else if( is_array($this->items[$offset]) )
		{
			return $this->items[$offset];
		}

		else
		{
			$value = $this->items[$offset];
		}

		return $value;
	}
1180896
public function offsetGet($offset)
    {
        if ($this->offsetExists($offset)) {
            return $this->items[$offset];
        }
        if ($this instanceof MandatoryKeyInterface) {
            throw new RuntimeException('Item does not exist at key: ' . $offset);
        }
        return null;
    }
1116175
public function paginate(Builder $builder, $perPage, $page)
    {
        $results = $this->performSearch($builder);

        if ($builder->limit) {
            $results['hits'] = $builder->limit;
        }

        $chunks = array_chunk($results['ids'], $perPage);

        if (! empty($chunks)) {
            if (array_key_exists($page - 1, $chunks)) {
                $results['ids'] = $chunks[$page - 1];
            } else {
                $results['ids'] = end($chunks);
            }
        }

        return $results;
    }
1141205
private function setPager($query, $page, $maxPerPage)
    {
        $adapter = new DoctrineORMAdapter($query);
        $pager = new PagerFanta($adapter);
        $pager
            ->setMaxPerPage($maxPerPage)
            ->setCurrentPage($page)
        ;

        // Pagerfanta returns a traversable object, not directly serializable
        $posts = [];
        foreach ($pager->getCurrentPageResults() as $post) {
            $posts[] = $post;
        }

        return [
            'total' => $pager->getNbResults(),
            'count' => count($posts),
            'posts' => $posts,
        ];
    }
590641
public function get($itemsToGet = 100, $offset = 0)
    {
        $userInfos = array();
        $this->createQuery();
        $r = parent::get($itemsToGet, intval($offset));
        foreach ($r as $row) {
            $ui = UserInfo::getByID($row['uID']);
            $userInfos[] = $ui;
        }

        return $userInfos;
    }
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);
		}
	}