mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-07 07:14:58 +00:00
cs: Fix code style (safe rules only).
This commit is contained in:
@@ -1,21 +1,10 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
* Copyright (C) 2016 Champs-Libres Coopérative <info@champs-libres.coop>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\MainBundle\Pagination;
|
||||
@@ -23,62 +12,57 @@ namespace Chill\MainBundle\Pagination;
|
||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
|
||||
/**
|
||||
* a page is an element of a pagination
|
||||
*
|
||||
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
||||
* @author Champs Libres <info@champs-libres.coop>
|
||||
* a page is an element of a pagination.
|
||||
*/
|
||||
class Page implements PageInterface
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @var UrlGeneratorInterface
|
||||
*/
|
||||
protected $urlGenerator;
|
||||
|
||||
/**
|
||||
* the number of the current page
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $number;
|
||||
|
||||
/**
|
||||
* The route for the current page
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $route;
|
||||
|
||||
/**
|
||||
* Parameters for the route to the current page
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $routeParameters;
|
||||
|
||||
/**
|
||||
* the number of item per page
|
||||
* the number of item per page.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $itemPerPage;
|
||||
|
||||
|
||||
/**
|
||||
* The number of items in the whole iteration
|
||||
* the number of the current page.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $number;
|
||||
|
||||
/**
|
||||
* The route for the current page.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $route;
|
||||
|
||||
/**
|
||||
* Parameters for the route to the current page.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $routeParameters;
|
||||
|
||||
/**
|
||||
* The number of items in the whole iteration.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $totalItems;
|
||||
|
||||
/**
|
||||
* @var UrlGeneratorInterface
|
||||
*/
|
||||
protected $urlGenerator;
|
||||
|
||||
public function __construct(
|
||||
$number,
|
||||
$itemPerPage,
|
||||
UrlGeneratorInterface $urlGenerator,
|
||||
$route,
|
||||
array $routeParameters,
|
||||
$totalItems
|
||||
$number,
|
||||
$itemPerPage,
|
||||
UrlGeneratorInterface $urlGenerator,
|
||||
$route,
|
||||
array $routeParameters,
|
||||
$totalItems
|
||||
) {
|
||||
$this->urlGenerator = $urlGenerator;
|
||||
$this->number = $number;
|
||||
@@ -87,7 +71,7 @@ class Page implements PageInterface
|
||||
$this->routeParameters = $routeParameters;
|
||||
$this->totalItems = $totalItems;
|
||||
}
|
||||
|
||||
|
||||
public function generateUrl()
|
||||
{
|
||||
return $this->urlGenerator->generate($this->route, $this->routeParameters);
|
||||
@@ -101,7 +85,7 @@ class Page implements PageInterface
|
||||
public function getLastItemNumber()
|
||||
{
|
||||
$last = $this->number * $this->itemPerPage - 1;
|
||||
|
||||
|
||||
return $last < $this->totalItems ? $last : $this->totalItems;
|
||||
}
|
||||
|
||||
@@ -109,5 +93,4 @@ class Page implements PageInterface
|
||||
{
|
||||
return $this->number;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user