Skip to content
This repository has been archived by the owner on Oct 24, 2018. It is now read-only.

Commit

Permalink
Merge pull request #20 from spatie/analysis-q5ABnY
Browse files Browse the repository at this point in the history
Apply fixes from StyleCI
  • Loading branch information
freekmurze authored Dec 16, 2016
2 parents 57bd683 + c978d0e commit 8734c9b
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 23 deletions.
14 changes: 7 additions & 7 deletions resources/lang/it/paginateroute.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

return [

'page' => 'pagina',
];
<?php

return [

'page' => 'pagina',

];
25 changes: 12 additions & 13 deletions src/PaginateRoute.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

namespace Spatie\PaginateRoute;

use Illuminate\Contracts\Pagination\Paginator;
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
use Illuminate\Contracts\Routing\UrlGenerator;
use Illuminate\Routing\Router;
use Illuminate\Translation\Translator;
use Illuminate\Contracts\Pagination\Paginator;
use Illuminate\Contracts\Routing\UrlGenerator;
use Illuminate\Contracts\Pagination\LengthAwarePaginator;

class PaginateRoute
{
Expand Down Expand Up @@ -86,7 +86,7 @@ public function isCurrentPage($page)
*/
public function nextPage(Paginator $paginator)
{
if (!$paginator->hasMorePages()) {
if (! $paginator->hasMorePages()) {
return;
}

Expand Down Expand Up @@ -177,7 +177,7 @@ public function previousPageUrl($full = false)
*/
public function allUrls(LengthAwarePaginator $paginator, $full = false)
{
if (!$paginator->hasPages()) {
if (! $paginator->hasPages()) {
return [];
}

Expand Down Expand Up @@ -212,27 +212,27 @@ public function renderPageList(LengthAwarePaginator $paginator, $full = false, $

$listItems = "<ul{$class}>";

if($this->hasPreviousPage() && $additionalLinks) {
if ($this->hasPreviousPage() && $additionalLinks) {
$listItems .= "<li><a href=\"{$this->previousPageUrl()}\">&laquo;</a></li>";
}

foreach ($urls as $i => $url) {

$pageNum = $i + 1;
$css = '';

if ($pageNum == $this->currentPage()) {
$css = " class=\"active\"";
$css = ' class="active"';
}

$listItems .= "<li{$css}><a href=\"{$url}\">{$pageNum}</a></li>";
}

if($this->hasNextPage($paginator) && $additionalLinks) {
if ($this->hasNextPage($paginator) && $additionalLinks) {
$listItems .= "<li><a href=\"{$this->nextPageUrl($paginator)}\">&raquo;</a></li>";
}

$listItems .= "</ul>";
$listItems .= '</ul>';

return $listItems;
}

Expand All @@ -249,10 +249,9 @@ public function renderRelLinks(LengthAwarePaginator $paginator, $full = false)
{
$urls = $this->allUrls($paginator, $full);

$linkItems = "";
$linkItems = '';

foreach ($urls as $i => $url) {

$pageNum = $i + 1;

switch ($pageNum - $this->currentPage()) {
Expand Down Expand Up @@ -317,7 +316,7 @@ public function pageUrl($page, $full = false)
public function addPageQuery($url, $page, $full = false)
{
// If the first page's URL is requested and $full is set to false, there's nothing to be added.
if ($page === 1 && !$full) {
if ($page === 1 && ! $full) {
return $url;
}

Expand Down
2 changes: 1 addition & 1 deletion src/SetPageMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Spatie\PaginateRoute;

use Route;
use Closure;
use Illuminate\Pagination\Paginator;
use Route;

class SetPageMiddleware
{
Expand Down
2 changes: 1 addition & 1 deletion tests/PaginateRouteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public function it_renders_an_html_list()

return [
'list' => $this->app['paginateroute']->renderPageList($dummies),
'listClass' => $this->app['paginateroute']->renderPageList($dummies, false, 'pagination')
'listClass' => $this->app['paginateroute']->renderPageList($dummies, false, 'pagination'),
];
});

Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ protected function registerDefaultRoute()

/**
* @param string $route
*
*
* @return array
*/
protected function callRoute($route)
Expand Down

0 comments on commit 8734c9b

Please sign in to comment.