whiteoctober / Pagerfanta

Pagination for PHP.
Other
1.59k stars 2 forks source link

Add interface for paginated result, without ability to get next/prev page #180

Open laland opened 9 years ago

laland commented 9 years ago

Hi. Interface segregation says: dont depend on something you dont need. Why not to add an interface that can only get current page itmes, nbPages, nbItems but without getPageX stuff. I dont need to get next page when i'm in the view context isn't it? But now i can. Isn't it an ISP violation?

richsage commented 9 years ago

@pablodip thoughts?

laland commented 9 years ago

why not to just add an interface, lets say "PaginatedResultInterface", that i can typehint my method's return type with it (in docblocks in php5 or eplicitly in upcoming php7). i think it'll solve the problem. or not? )

laland commented 9 years ago

i can do it in a pr, should i?

pablodip commented 9 years ago

Is the only problem pureness or is there anything you cannot do?

laland commented 9 years ago

but why not to add it just for pureness, so people will be able to typehint their methods return types