src/AppBundle/Common/Paginator.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace AppBundle\Common;
class Paginator
{
protected $itemCount;
protected $perPageCount;
protected $currentPage;
protected $pageRange = 10;
protected $baseUrl;
protected $pageKey = 'page';
public function __construct($request, $total, $perPage = 20)
{
$this->setItemCount($total);
$this->setPerPageCount($perPage);
$page = (int) $request->query->get('page');
$maxPage = ceil($total / $perPage) ?: 1;
$this->setCurrentPage($page <= 0 ? 1 : ($page > $maxPage ? $maxPage : $page));
$this->setBaseUrl($request->server->get('REQUEST_URI'));
}
public function setItemCount($count)
{
$this->itemCount = $count;
return $this;
}
public function setPerPageCount($count)
{
$this->perPageCount = $count;
return $this;
}
public function getPerPageCount()
{
return $this->perPageCount;
}
public function setCurrentPage($page)
{
$this->currentPage = $page;
return $this;
}
public function setPageRange($range)
{
$this->pageRange = $range;
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。