Возвращает контекс пагинатора.
@param IPaginator $paginator
@return array
340585
protected function buildContext(IPaginator $paginator)
    {
        $firstItemNumber = ($paginator->getCurrentPage() - 1) * $paginator->getItemsPerPage();
        $currentItemsCount = $paginator->getCurrentPage() < $paginator->getPagesCount() ? $paginator->getItemsPerPage(
        ) : $paginator->getItemsCount() - $firstItemNumber;

        return [
            'firstPage'         => 1,
            'lastPage'          => $paginator->getPagesCount(),
            'currentPage'       => $paginator->getCurrentPage(),
            'pagesCount'        => $paginator->getPagesCount(),
            'itemsPerPage'      => $paginator->getItemsPerPage(),
            'previousPage'      => ($paginator->getCurrentPage() > 1) ? $paginator->getCurrentPage() - 1 : null,
            'nextPage'          => ($paginator->getCurrentPage() < $paginator->getPagesCount(
                    )) ? $paginator->getCurrentPage() + 1 : null,
            'currentItemsCount' => $currentItemsCount,
            'itemsCount'        => $paginator->getItemsCount(),
            'firstItemNumber'   => $firstItemNumber + 1,
            'lastItemNumber'    => $firstItemNumber + $currentItemsCount
        ];
    }
830652
public function getLeftPoint(LengthAwarePaginator $paginator)
    {
        $side = $paginator->onEachSide;
        $current = $paginator->currentPage();
        $last = $paginator->lastPage();

        if (! empty($side)) {
            $x = $current + $side;
            $offset = $x >= $last ? $x - $last : 0;
            $left = $current - $side - $offset;
        }

        return ! isset($left) || $left < 1 ? 1 : $left;
    }
1178767
public function pagination($paginator, $options=array())
	{
		switch (UIKit::getEnvironment()) {
			case 'laravel4':
					return $this->paginateLaravelCollection($paginator, $options);
				break;
			default:
				throw new Exception("UIKit can not detect the framework to autopaginate");

				break;
		}
	}
1029435
public function pageInfoResolver(LengthAwarePaginator $paginator): array
    {
        return [
            'total' => $paginator->total(),
            'count' => $paginator->count(),
            'currentPage' => $paginator->currentPage(),
            'lastPage' => $paginator->lastPage(),
            'hasNextPage' => $paginator->hasMorePages(),
            'hasPreviousPage' => $paginator->currentPage() > 1,
            'startCursor' => $paginator->firstItem()
                ? Cursor::encode($paginator->firstItem())
                : null,
            'endCursor' => $paginator->lastItem()
                ? Cursor::encode($paginator->lastItem())
                : null,
        ];
    }
415704
private function getExtensionList($type, PaginationInterface $pagination)
    {
        $extList = [];
        if (isset($this->typeExtension[$type])) {
            ksort($this->typeExtension[$type]);
            $typeExt = call_user_func_array('array_merge', $this->typeExtension[$type]);
            foreach ($typeExt as $name => $item) {
                $extList = $this->getExtList($name, $pagination, $extList);
            }
        }

        return $extList;
    }
987333
public function getPaginationControl(PaginatorInterface $paginator) {
		$currentPage = $paginator->getCurrentPage();
		
		$data = [
			PaginatorInterface::CONTROL_CURRENT => $currentPage,
			PaginatorInterface::CONTROL_RANGE   => [$currentPage]
		];
		
		if ($currentPage > 2) {
			$data[PaginatorInterface::CONTROL_FIRST] = 1;
		}
		
		if ($currentPage > 1) {
			$data[PaginatorInterface::CONTROL_PREVIOUS] = $currentPage - 1;
		}
		
		if ($paginator->count() >= $paginator->getItemsNumberPerPage()) {
			$data[PaginatorInterface::CONTROL_NEXT] = $currentPage + 1;
		}
		
		return $data;
	}
893974
protected function getItems(Paginator $subject)
    {
        $object = new ReflectionObject($subject);

        $items = $object->getProperty('items');
        $items->setAccessible(true);

        return $items->getValue($subject);
    }
79296
public function read(Paginator $paginator = NULL) {
		if ($this->hasNonSaveEntity() === FALSE) {
			$this->rows = array();
		}
		$this->selection = $this->buildSql($paginator);
		return $this;
	}
356843
public function buildRawPaginator($paginator, $results, $perPage)
	{
		// For queries which have a group by, we will actually retrieve the entire set
		// of rows from the table and "slice" them via PHP. This is inefficient and
		// the developer must be aware of this behavior; however, it's an option.
		$start = ($paginator->getCurrentPage() - 1) * $perPage;

		$sliced = array_slice($results, $start, $perPage);

		return $paginator->make($sliced, count($results), $perPage);
	}
172377
public function paginatorInfoResolver(LengthAwarePaginator $root): array
    {
        return [
            'count' => $root->count(),
            'currentPage' => $root->currentPage(),
            'firstItem' => $root->firstItem(),
            'hasMorePages' => $root->hasMorePages(),
            'lastItem' => $root->lastItem(),
            'lastPage' => $root->lastPage(),
            'perPage' => $root->perPage(),
            'total' => $root->total(),
        ];
    }
938451
public function usingPaginator($paginator = null): TransformationFactory
	{
		if (! ($this->resource instanceof Collection) || ! ($this->entity instanceof LengthAwarePaginator)) {
			throw new \InvalidArgumentException('Bad Request Issued');
		}

		$this->resource->setPaginator(new IlluminatePaginatorAdapter($this->entity));

		return $this;
	}
1244073
public function getPaginator()
    {
        $permissions = $this->getPermissionsModel();

        return $this->getMapper()
                    ->getPaginator( array(
                        new PredicateSet(
                            array(
                                new In( 'user.id', array_keys(
                                    $permissions->allowedUsers( 'view' )
                                ) ),
                                new In( 'user.groupId', array_keys(
                                    $permissions->allowedUserGroups( 'view' )
                                ) ),
                            ),
                            PredicateSet::OP_OR
                        ),
                    ) );
    }
786955
protected function listEntityIds(PagerInterface $pager = null, array $query_params = []): array
    {
        /** @var \Apigee\Edge\Api\Management\Entity\OrganizationInterface $organization */
        $organization = $this->getOrganizationController()->load($this->getOrganisationName());
        $isCpsEnabled = $organization->getPropertyValue('features.isCpsEnabled');

        if ($isCpsEnabled) {
            return $this->listEntityIdsWithCps($pager, $query_params);
        } else {
            $this->triggerCpsSimulationNotice($pager);

            return $this->listEntityIdsWithoutCps($pager, $query_params);
        }
    }
181828
protected function transformPaginator($paginator)
    {
        $collection = $paginator->getCollection();
        $resource = new Collection($collection, $this->getTransformer(), $this->resourceKeyCollection);
        $resource->setPaginator(new IlluminatePaginatorAdapter($paginator));

        return $resource;
    }
775795
public function getPagination(LengthAwarePaginator $paginator, $transformer = null, $resourceKey = null)
    {
        // Append existing query parameter to pagination link
        // @see http://fractal.thephpleague.com/pagination/#including-existing-query-string-values-in-pagination-links
        $queryParams = array_diff_key($_GET, array_flip(['page']));

        foreach ($queryParams as $key => $value) {
            $paginator->appends($key, $value);
        }

        $collection = $paginator->getCollection();

        $resource = new FractalCollection(
            $collection,
            $this->getTransformer($transformer),
            $this->getResourceKey($resourceKey)
        );
        $resource->setPaginator(new IlluminatePaginatorAdapter($paginator));

        if ($meta = $this->getMeta()) {
            $resource->setMeta($meta);
            $this->meta = [];
        }

        return $this->fractal->createData($resource)->toArray();
    }
1076907
public function paginator()
    {
        $paginator = $this->paginate();

        if (!is_null($this->presenter)) {
            return (new $this->presenter($paginator))->render();
        }

        return $paginator->render();
    }
416257
protected function resolvePerPage($paginate)
    {
        if ($perPage = app('request')->input($this->perPageName)) {
            if (is_array($paginate)) {
                $paginate['arguments'][0] = (int) $perPage;

                return $paginate['arguments'];
            }

            $this->perPage = (int) $perPage;
        }

        if (isset($paginate['arguments'][0])) {
            return $paginate['arguments'];
        }

        return [$this->perPage];
    }