@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | /** |
| 36 | 36 | * @param array $aria |
| 37 | 37 | */ |
| 38 | - public function __construct(array $aria=[]) |
|
| 38 | + public function __construct(array $aria = []) |
|
| 39 | 39 | { |
| 40 | 40 | $this->aria_label = $aria + $this->aria_label; |
| 41 | 41 | } |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | * @param array $aria |
| 45 | 45 | * @return AbstractPaginate |
| 46 | 46 | */ |
| 47 | - public static function forge(array $aria=[]) |
|
| 47 | + public static function forge(array $aria = []) |
|
| 48 | 48 | { |
| 49 | 49 | $self = new static($aria); |
| 50 | 50 | return $self; |
@@ -108,8 +108,8 @@ discard block |
||
| 108 | 108 | protected function checkIfInPageList($page, array $page_list) |
| 109 | 109 | { |
| 110 | 110 | $pageNum = $this->calcPageNum($page); |
| 111 | - foreach( $page_list as $p) { |
|
| 112 | - if($p['page'] === $pageNum) return true; |
|
| 111 | + foreach ($page_list as $p) { |
|
| 112 | + if ($p['page'] === $pageNum) return true; |
|
| 113 | 113 | } |
| 114 | 114 | return false; |
| 115 | 115 | } |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | $pageNum = $this->calcPageNum($page); |
| 125 | 125 | $href = ($pageNum == $this->inputs->getPage()) ? |
| 126 | 126 | '#' : $this->inputs->getPath($pageNum); |
| 127 | - $aria = isset($this->aria_label[$page]) ? $this->aria_label[$page]: ''; |
|
| 127 | + $aria = isset($this->aria_label[$page]) ? $this->aria_label[$page] : ''; |
|
| 128 | 128 | return ['rel' => $page, 'href' => $href, 'aria' => $aria, 'label' => $label, 'page' => $pageNum]; |
| 129 | 129 | } |
| 130 | 130 | |
@@ -134,10 +134,10 @@ discard block |
||
| 134 | 134 | */ |
| 135 | 135 | protected function calcPageNum($page) |
| 136 | 136 | { |
| 137 | - if (is_numeric($page) ) { |
|
| 137 | + if (is_numeric($page)) { |
|
| 138 | 138 | return $page; |
| 139 | 139 | } elseif (is_string($page)) { |
| 140 | - $method = 'calc' . ucwords($page) . 'Page'; |
|
| 140 | + $method = 'calc'.ucwords($page).'Page'; |
|
| 141 | 141 | $pageNum = $this->inputs->$method(); |
| 142 | 142 | return $pageNum; |
| 143 | 143 | } |
@@ -109,7 +109,9 @@ |
||
| 109 | 109 | { |
| 110 | 110 | $pageNum = $this->calcPageNum($page); |
| 111 | 111 | foreach( $page_list as $p) { |
| 112 | - if($p['page'] === $pageNum) return true; |
|
| 112 | + if($p['page'] === $pageNum) { |
|
| 113 | + return true; |
|
| 114 | + } |
|
| 113 | 115 | } |
| 114 | 116 | return false; |
| 115 | 117 | } |
@@ -255,7 +255,7 @@ |
||
| 255 | 255 | return $this->path; |
| 256 | 256 | } |
| 257 | 257 | $page = (int)$page; |
| 258 | - return $this->path . '?' . $this->pagerKey . '=' . $page; |
|
| 258 | + return $this->path.'?'.$this->pagerKey.'='.$page; |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | /** |
@@ -101,8 +101,7 @@ discard block |
||
| 101 | 101 | $rel = isset($info['rel']) ? $info['rel'] : ''; |
| 102 | 102 | $href = isset($info['href']) ? $info['href'] : ''; |
| 103 | 103 | $aria = isset($info['aria']) ? $info['aria'] : ''; |
| 104 | - $label = isset($info['label']) && $info['label'] ? $info['label'] : |
|
| 105 | - (isset($this->labels[$rel]) ? $this->labels[$rel] : $rel); |
|
| 104 | + $label = isset($info['label']) && $info['label'] ? $info['label'] : (isset($this->labels[$rel]) ? $this->labels[$rel] : $rel); |
|
| 106 | 105 | return $this->bootLi($label, $href, $aria); |
| 107 | 106 | } |
| 108 | 107 | |
@@ -117,7 +116,7 @@ discard block |
||
| 117 | 116 | $srLbl = $aria ? " aria-label=\"{$aria}\"" : ''; |
| 118 | 117 | if ($href != '#') { |
| 119 | 118 | $html = "<li><a href=\"{$href}\""; |
| 120 | - $html .= $srLbl . " >{$label}</a></li>\n"; |
|
| 119 | + $html .= $srLbl." >{$label}</a></li>\n"; |
|
| 121 | 120 | } elseif (is_numeric($label)) { |
| 122 | 121 | $html = "<li class=\"active\"><a href=\"#\" >{$label}</a></li>\n"; |
| 123 | 122 | } else { |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | */ |
| 144 | 144 | private function secureInput(array $query) |
| 145 | 145 | { |
| 146 | - $secure = $this->validator ?: function (&$v) { |
|
| 146 | + $secure = $this->validator ?: function(&$v) { |
|
| 147 | 147 | if (!is_string($v) && !is_numeric($v)) { |
| 148 | 148 | $v = ''; |
| 149 | 149 | } elseif (strpos($v, "\0") !== false) { |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | private function setSessionName($pathInfo) |
| 195 | 195 | { |
| 196 | 196 | $this->path = $pathInfo; |
| 197 | - $this->name = 'pager-' . md5($pathInfo); |
|
| 197 | + $this->name = 'pager-'.md5($pathInfo); |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | /** |