for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace KGzocha\Searcher\Criteria\Adapter;
use KGzocha\Searcher\Criteria\PaginationCriteriaInterface;
/**
* This adapter will not allow to change itemsPerPage parameter in adapted pagination Criteria.
* Every other behaviour will be untouched.
*
* @author Krzysztof Gzocha <[email protected]>
*/
class ImmutablePaginationAdapter implements PaginationCriteriaInterface
{
* @var PaginationCriteriaInterface
private $pagination;
* @param PaginationCriteriaInterface $pagination
public function __construct(PaginationCriteriaInterface $pagination)
$this->pagination = $pagination;
}
* {@inheritdoc}
public function getPage(): int
return $this->pagination->getPage();
public function getItemsPerPage(): int
return $this->pagination->getItemsPerPage();
public function setPage(int $page = null)
return $this->pagination->setPage($page);
* This method will not allow to change items per page.
* On each call it will set the same value.
public function setItemsPerPage(int $itemsPerPage = null)
return $this
->pagination
->setItemsPerPage(
$this->pagination->getItemsPerPage()
);
public function shouldBeApplied(): bool
return $this->pagination->shouldBeApplied();