Skip to content

Commit

Permalink
phpcs fixes in PaginatorHelper.php.
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Krämer committed Jan 19, 2015
1 parent 22bb289 commit 30aa5fb
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions src/View/Helper/PaginatorHelper.php
Expand Up @@ -674,7 +674,7 @@ protected function _getNumbersStartAndEnd($params, $options)
/**
* Formats a number for the paginator number output.
*
* @param StringTemplate $templater
* @param \Cake\View\StringTemplate $templater StringTemplate instance.
* @param array $options Options from the numbers() method.
* @return string
*/
Expand All @@ -690,7 +690,7 @@ protected function _formatNumber($templater, $options)
/**
* Generates the numbers for the paginator numbers() method.
*
* @param StringTemplate $templater
* @param \Cake\View\StringTemplate $templater StringTemplate instance.
* @param array $params Params from the numbers() method.
* @param array $options Options from the numbers() method.
* @return string Markup output.
Expand All @@ -700,13 +700,13 @@ protected function _modulusNumbers($templater, $params, $options)
$out = '';
$ellipsis = $templater->format('ellipsis', []);

extract($this->_getNumbersStartAndEnd($params, $options));
$startAndEnd = ($this->_getNumbersStartAndEnd($params, $options));

$out .= $this->_firstNumber($ellipsis, $params, $start, $options);
$out .= $this->_firstNumber($ellipsis, $params, $startAndEnd['start'], $options);

$out .= $options['before'];

for ($i = $start; $i < $params['page']; $i++) {
for ($i = $startAndEnd['start']; $i < $params['page']; $i++) {
$out .= $this->_formatNumber($templater, [
'text' => $i,
'page' => $i,
Expand All @@ -720,37 +720,38 @@ protected function _modulusNumbers($templater, $params, $options)
]);

$start = $params['page'] + 1;
for ($i = $start; $i < $end; $i++) {
for ($i = $start; $i < $startAndEnd['end']; $i++) {
$out .= $this->_formatNumber($templater, [
'text' => $i,
'page' => $i,
'model' => $options['model']
]);
}

if ($end != $params['page']) {
if ($startAndEnd['end'] != $params['page']) {
$out .= $this->_formatNumber($templater, [
'text' => $i,
'page' => $end,
'page' => $startAndEnd['end'],
'model' => $options['model']
]);
}

$out .= $options['after'];
$out .= $this->_lastNumber($ellipsis, $params, $end, $options);
$out .= $this->_lastNumber($ellipsis, $params, $startAndEnd['end'], $options);
return $out;
}

/**
* Generates the last number for the paginator numbers() method.
*
* @param StringTemplate $ellipsis
* @param \Cake\View\StringTemplate $ellipsis StringTemplate instance.
* @param array $params Params from the numbers() method.
* @param int $start Start number.
* @param array $options Options from the numbers() method.
* @return string Markup output.
*/
protected function _firstNumber($ellipsis, $params, $start, $options) {
protected function _firstNumber($ellipsis, $params, $start, $options)
{
$out = '';
if ($options['first'] && $start > 1) {
$offset = ($start <= (int)$options['first']) ? $start - 1 : $options['first'];
Expand All @@ -765,13 +766,14 @@ protected function _firstNumber($ellipsis, $params, $start, $options) {
/**
* Generates the last number for the paginator numbers() method.
*
* @param StringTemplate $ellipsis
* @param \Cake\View\StringTemplate $ellipsis StringTemplate instance.
* @param array $params Params from the numbers() method.
* @param int $end End number.
* @param array $options Options from the numbers() method.
* @return string Markup output.
*/
protected function _lastNumber($ellipsis, $params, $end, $options) {
protected function _lastNumber($ellipsis, $params, $end, $options)
{
$out = '';
if ($options['last'] && $end < $params['pageCount']) {
$offset = ($params['pageCount'] < $end + (int)$options['last']) ? $params['pageCount'] - $end : $options['last'];
Expand All @@ -786,12 +788,13 @@ protected function _lastNumber($ellipsis, $params, $end, $options) {
/**
* Generates the numbers for the paginator numbers() method.
*
* @param StringTemplate $templater
* @param \Cake\View\StringTemplate $templater StringTemplate instance.
* @param array $params Params from the numbers() method.
* @param array $options Options from the numbers() method.
* @return string Markup output.
*/
protected function _numbers($templater, $params, $options) {
protected function _numbers($templater, $params, $options)
{
$out = '';
$out .= $options['before'];
for ($i = 1; $i <= $params['pageCount']; $i++) {
Expand Down

0 comments on commit 30aa5fb

Please sign in to comment.