somework/offset-page-logic

Logic to convert offset request to page request

1.0.7 2017-06-05 08:59 UTC

This package is auto-updated.

Last update: 2024-03-29 03:19:39 UTC


README

Author: Igor Pinchuk
Email: i.pinchuk.work@gmail.com

Travis build Scrutinizer Code Quality SensioLabsInsight StyleCI

Package that handle problem when you have only page, pagesize source interface and you need offset limit interface

$offset = 0;
$limit = 0;
$nowCount = 0;

$result = \SomeWork\OffsetPage\Logic\Offset::logic($offset, $limit, $nowCount);
$result->getPage(); //0
$result->getSize(); //0
$offset = 0;
$limit = 5;
$nowCount = 5;

$result = \SomeWork\OffsetPage\Logic\Offset::logic($offset, $limit, $nowCount);
// Throw exception \SomeWork\OffsetPage\Logic\AlreadyGetNeededCountException

License

MIT