Skip to content

Commit

Permalink
Disable sorting by direct URL
Browse files Browse the repository at this point in the history
  • Loading branch information
samdark committed Sep 27, 2024
1 parent ded16b0 commit 94ebc30
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/BaseListView.php
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,11 @@ private function prepareDataReaderByParams(
): ReadableDataInterface {
$dataReader = $this->getDataReader();

if ($dataReader instanceof LimitableDataInterface && $dataReader->getLimit() !== null) {

Check warning on line 350 in src/BaseListView.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.2-ubuntu-latest

Escaped Mutant for Mutator "NotIdentical": --- Original +++ New @@ @@ private function prepareDataReaderByParams(?string $page, ?string $previousPage, ?string $pageSize, ?string $sort, array $filters) : ReadableDataInterface { $dataReader = $this->getDataReader(); - if ($dataReader instanceof LimitableDataInterface && $dataReader->getLimit() !== null) { + if ($dataReader instanceof LimitableDataInterface && $dataReader->getLimit() === null) { // Disable sorting for data reader with pre-defined limit. $sort = null; }

Check warning on line 350 in src/BaseListView.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.2-ubuntu-latest

Escaped Mutant for Mutator "LogicalAndNegation": --- Original +++ New @@ @@ private function prepareDataReaderByParams(?string $page, ?string $previousPage, ?string $pageSize, ?string $sort, array $filters) : ReadableDataInterface { $dataReader = $this->getDataReader(); - if ($dataReader instanceof LimitableDataInterface && $dataReader->getLimit() !== null) { + if (!($dataReader instanceof LimitableDataInterface && $dataReader->getLimit() !== null)) { // Disable sorting for data reader with pre-defined limit. $sort = null; }
// Disable sorting for data reader with pre-defined limit.
$sort = null;
}

if (!$dataReader instanceof PaginatorInterface) {
if (
$dataReader instanceof OffsetableDataInterface

Check warning on line 357 in src/BaseListView.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.2-ubuntu-latest

Escaped Mutant for Mutator "LogicalAnd": --- Original +++ New @@ @@ $sort = null; } if (!$dataReader instanceof PaginatorInterface) { - if ($dataReader instanceof OffsetableDataInterface && $dataReader instanceof CountableDataInterface && $dataReader instanceof LimitableDataInterface) { + if (($dataReader instanceof OffsetableDataInterface || $dataReader instanceof CountableDataInterface) && $dataReader instanceof LimitableDataInterface) { $dataReader = new OffsetPaginator($dataReader); } elseif ($dataReader instanceof FilterableDataInterface && $dataReader instanceof SortableDataInterface && $dataReader instanceof LimitableDataInterface) { if ($dataReader->getSort() !== null) {
Expand Down

0 comments on commit 94ebc30

Please sign in to comment.