@@ -106,7 +106,7 @@ |
||
106 | 106 | * |
107 | 107 | * @API |
108 | 108 | * @param array $query query like $_GET |
109 | - * @param null $path path info |
|
109 | + * @param string $path path info |
|
110 | 110 | * @return Pager |
111 | 111 | */ |
112 | 112 | public function withQuery(array $query, $path = null) |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $this->pagerKey => 1, |
71 | 71 | $this->limitKey => 20 |
72 | 72 | ]; |
73 | - $this->inputObject = $inputObject; |
|
73 | + $this->inputObject = $inputObject; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | public static function forge($name = '', array $default = [], $inputObject = null) |
83 | 83 | { |
84 | 84 | $self = new self($default, $inputObject); |
85 | - $self->name = $name ?: 'pager-' . $name; |
|
85 | + $self->name = $name ?: 'pager-'.$name; |
|
86 | 86 | |
87 | 87 | return $self; |
88 | 88 | } |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | */ |
158 | 158 | private function secureInput(array $query) |
159 | 159 | { |
160 | - $secure = $this->validator ?: function (&$v) { |
|
160 | + $secure = $this->validator ?: function(&$v) { |
|
161 | 161 | if (!is_string($v) && !is_numeric($v)) { |
162 | 162 | $v = ''; |
163 | 163 | } elseif (strpos($v, "\0") !== false) { |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | private function setSessionName($pathInfo) |
209 | 209 | { |
210 | 210 | $this->path = $pathInfo; |
211 | - $this->name = $this->name ?: 'pager-' . md5($pathInfo); |
|
211 | + $this->name = $this->name ?: 'pager-'.md5($pathInfo); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | /** |
@@ -78,6 +78,9 @@ |
||
78 | 78 | return "<li><a href=\"{$href}\" >{$label}{$only}</a></li>\n"; |
79 | 79 | } |
80 | 80 | |
81 | + /** |
|
82 | + * @param string $label |
|
83 | + */ |
|
81 | 84 | private function liLabel(Page $p, $label) |
82 | 85 | { |
83 | 86 | return "<li class=\"{$p->isCurrent('disabled')}\"><a href=\"{$p->isCurrent('#', $p->getUrl())}\" >{$label}</a></li>\n"; |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | public function getIterator() |
82 | 82 | { |
83 | 83 | $pages = $this->calcPageList(); |
84 | - foreach($pages as $p) { |
|
84 | + foreach ($pages as $p) { |
|
85 | 85 | yield $p; |
86 | 86 | } |
87 | 87 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | */ |
113 | 113 | private function calcStart() |
114 | 114 | { |
115 | - $half = (int) ($this->numLinks / 2); |
|
115 | + $half = (int)($this->numLinks / 2); |
|
116 | 116 | $start = max($this->currPage - $half, $this->firstPage + 1); |
117 | 117 | $maybe = max($this->lastPage - 1 - $this->numLinks, $this->firstPage + 1); |
118 | 118 | $start = min($start, $maybe); |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | */ |
140 | 140 | private function calcLast() |
141 | 141 | { |
142 | - $numLinks = $this->numLinks - 1 + ($this->getExtraStart() ? 0: 1); |
|
142 | + $numLinks = $this->numLinks - 1 + ($this->getExtraStart() ? 0 : 1); |
|
143 | 143 | $last = min($this->calcStart() + $numLinks, $this->lastPage - 1); |
144 | 144 | return $last; |
145 | 145 | } |
@@ -78,6 +78,9 @@ |
||
78 | 78 | return "<li class='page-item'><a class='page-link' href=\"{$href}\" >{$label}{$only}</a></li>\n"; |
79 | 79 | } |
80 | 80 | |
81 | + /** |
|
82 | + * @param string $label |
|
83 | + */ |
|
81 | 84 | private function liLabel(Page $p, $label) |
82 | 85 | { |
83 | 86 | return "<li class=\"{$p->isCurrent('disabled')}\"><a class='page-link' href=\"{$p->isCurrent('#', $p->getUrl())}\" >{$label}</a></li>\n"; |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | public function __construct($key, $currPage, $page) |
31 | 31 | { |
32 | 32 | $this->pagerKey = $key; |
33 | - $this->currPage = (int) $currPage; |
|
34 | - $this->page = (int) $page; |
|
33 | + $this->currPage = (int)$currPage; |
|
34 | + $this->page = (int)$page; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function getPage() |
41 | 41 | { |
42 | - return (int) $this->page ?: ''; |
|
42 | + return (int)$this->page ?: ''; |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | public function isCurrent($true = true, $false = false) |
51 | 51 | { |
52 | 52 | return $this->currPage === $this->page |
53 | - ? $true: $false; |
|
53 | + ? $true : $false; |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | public function isDisabled($true = true, $false = false) |
62 | 62 | { |
63 | 63 | return !$this->page |
64 | - ? $true: $false; |
|
64 | + ? $true : $false; |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | if (!$this->inputs[$key]) { |
101 | 101 | return $default; |
102 | 102 | } |
103 | - $value = (int) $this->inputs[$key]; |
|
103 | + $value = (int)$this->inputs[$key]; |
|
104 | 104 | return is_integer($value) ? $value : $default; |
105 | 105 | } |
106 | 106 | |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | return $this->path; |
210 | 210 | } |
211 | 211 | $page = (int)$page; |
212 | - return $this->path . '?' . $this->pagerKey . '=' . $page; |
|
212 | + return $this->path.'?'.$this->pagerKey.'='.$page; |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | /** |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | { |
228 | 228 | $class = $this->defaultToHtml; |
229 | 229 | $toHtml = new $class(Paginate::forge($this)); |
230 | - return (string) $toHtml; |
|
230 | + return (string)$toHtml; |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | /** |