|
1
|
|
|
<?php #compile |
|
2
|
|
|
/** @var object $_paginator_ */ |
|
3
|
|
|
$this->runtimeVariable('_paginator_', '${paginator}${source}${list}'); |
|
4
|
|
|
|
|
5
|
|
|
/** @var int $_pageLimit_ */ |
|
6
|
|
|
$this->runtimeVariable('_pageLimit_', '${pageLimit|2}'); |
|
7
|
|
|
?><?php |
|
8
|
|
|
//This code will be executed on every render request |
|
9
|
|
|
if ($_paginator_ instanceof \Spiral\Pagination\PaginatorAwareInterface) { |
|
10
|
|
|
$_paginator_ = $_paginator_->hasPaginator() ? $_paginator_->getPaginator(false) : null; |
|
|
|
|
|
|
11
|
|
|
} |
|
12
|
|
|
|
|
13
|
|
|
$_uri_fragment_ = !empty($_tab_id_) ? '#' . $_tab_id_ : ''; |
|
14
|
|
|
|
|
15
|
|
|
if ( |
|
16
|
|
|
!empty($_paginator_) |
|
17
|
|
|
&& $_paginator_ instanceof \Spiral\Pagination\PagedInterface |
|
18
|
|
|
&& $_paginator_->isRequired() |
|
19
|
|
|
) { |
|
20
|
|
|
/** @var \Spiral\Toolkit\PaginationHelper $route */ |
|
21
|
|
|
$_helper_ = spiral(\Spiral\Toolkit\PaginationHelper::class); |
|
22
|
|
|
?> |
|
23
|
|
|
<div class="paginator"> |
|
24
|
|
|
<ul class="pagination ${class} ${align | center}-align" node:attributes="exclude:context"> |
|
25
|
|
|
<?php |
|
26
|
|
|
if (!empty($_page_ = $_paginator_->previousPage())) { |
|
27
|
|
|
echo "<li class=\"waves-effect\"><a href=\"{$_helper_->uri($_paginator_, $_page_)}{$_uri_fragment_}\"><i class=\"material-icons\">chevron_left</i></a></li>"; |
|
28
|
|
|
} else { |
|
29
|
|
|
echo "<li class=\"disabled\"><a href=\"javascript:return false;\"><i class=\"material-icons\">chevron_left</i></a></li>"; |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
//Page numbers |
|
33
|
|
|
$_current_ = $_paginator_->getPage(); |
|
34
|
|
|
$_first_ = max( |
|
35
|
|
|
$_current_ - $_pageLimit_, |
|
36
|
|
|
1 |
|
37
|
|
|
); |
|
38
|
|
|
$_last_ = min( |
|
39
|
|
|
$_current_ + $_pageLimit_, |
|
40
|
|
|
$_paginator_->countPages() |
|
41
|
|
|
); |
|
42
|
|
|
|
|
43
|
|
|
if ($_first_ != 1) { |
|
44
|
|
|
//Just a placeholder |
|
45
|
|
|
echo "<li class=\"waves-effect\"><a>...</a></li>"; |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
for ($_page_ = $_first_; $_page_ <= $_last_; $_page_++) { |
|
49
|
|
|
if ($_page_ == $_current_) { |
|
50
|
|
|
echo "<li class=\"active\"><a href=\"{$_helper_->uri($_paginator_, $_page_)}{$_uri_fragment_}\">{$_page_}</a></li>"; |
|
51
|
|
|
} else { |
|
52
|
|
|
echo "<li class=\"waves-effect\"><a href=\"{$_helper_->uri($_paginator_, $_page_)}{$_uri_fragment_}\">{$_page_}</a></li>"; |
|
53
|
|
|
} |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
if ($_last_ != $_paginator_->countPages()) { |
|
57
|
|
|
echo "<li class=\"waves-effect\"><a>...</a></li>"; |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
if (!empty($_page_ = $_paginator_->nextPage())) { |
|
61
|
|
|
echo "<li class=\"next waves-effect\"><a href=\"{$_helper_->uri($_paginator_, $_page_)}{$_uri_fragment_}\"><i class=\"material-icons\">chevron_right</i></a></li>"; |
|
62
|
|
|
} else { |
|
63
|
|
|
echo "<li class=\"disabled\"><a href=\"javascript:return false;\"><i class=\"material-icons\">chevron_right</i></a></li>"; |
|
64
|
|
|
} |
|
65
|
|
|
?> |
|
66
|
|
|
</ul> |
|
67
|
|
|
</div> |
|
68
|
|
|
<?php } ?> |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignorePhpDoc annotation to the duplicate definition and it will be ignored.