Skip to content

Commit ae454fb

Browse files
committed
Merge pull request #96 from garak/interface
add PaginatorInterface
2 parents 61dfa03 + d8668fd commit ae454fb

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

src/Knp/Component/Pager/Paginator.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* wanted target and finally it generates pagination view
1616
* which is only the result of paginator
1717
*/
18-
class Paginator
18+
class Paginator implements PaginatorInterface
1919
{
2020
/**
2121
* @var \Symfony\Component\EventDispatcher\EventDispatcherInterface
@@ -80,7 +80,7 @@ public function setDefaultPaginatorOptions(array $options)
8080
* @throws \LogicException
8181
* @return \Knp\Component\Pager\Pagination\PaginationInterface
8282
*/
83-
public function paginate($target, $page = 1, $limit = 10, $options = array())
83+
public function paginate($target, $page = 1, $limit = 10, array $options = array())
8484
{
8585
$limit = intval(abs($limit));
8686
if (!$limit) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
namespace Knp\Component\Pager;
4+
5+
/**
6+
* PaginatorInterface
7+
*/
8+
interface PaginatorInterface
9+
{
10+
/**
11+
* Paginates anything (depending on event listeners)
12+
* into Pagination object, which is a view targeted
13+
* pagination object (might be aggregated helper object)
14+
* responsible for the pagination result representation
15+
*
16+
* @param mixed $target - anything what needs to be paginated
17+
* @param integer $page - page number, starting from 1
18+
* @param integer $limit - number of items per page
19+
* @param array $options - less used options:
20+
* boolean $distinct - default true for distinction of results
21+
* string $alias - pagination alias, default none
22+
* array $whitelist - sortable whitelist for target fields being paginated
23+
* @throws \LogicException
24+
* @return \Knp\Component\Pager\Pagination\PaginationInterface
25+
*/
26+
function paginate($target, $page = 1, $limit = 10, array $options = array());
27+
}

0 commit comments

Comments
 (0)