mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-23 04:00:23 +08:00
minor refactoring.
This commit is contained in:
@ -133,7 +133,8 @@ class Pagination extends Object
|
||||
{
|
||||
if ($this->_page === null || $recalculate) {
|
||||
if (($params = $this->params) === null) {
|
||||
$params = (Yii::$app->request instanceof Request) ? Yii::$app->request->get : [];
|
||||
$request = Yii::$app->getRequest();
|
||||
$params = $request instanceof Request ? $request->get() : [];
|
||||
}
|
||||
if (isset($params[$this->pageVar]) && is_scalar($params[$this->pageVar])) {
|
||||
$this->_page = (int)$params[$this->pageVar] - 1;
|
||||
@ -173,7 +174,8 @@ class Pagination extends Object
|
||||
public function createUrl($page)
|
||||
{
|
||||
if (($params = $this->params) === null) {
|
||||
$params = (Yii::$app->request instanceof Request) ? Yii::$app->request->get : [];
|
||||
$request = Yii::$app->getRequest();
|
||||
$params = $request instanceof Request ? $request->get() : [];
|
||||
}
|
||||
if ($page > 0 || $page >= 0 && $this->forcePageVar) {
|
||||
$params[$this->pageVar] = $page + 1;
|
||||
|
Reference in New Issue
Block a user