Added support for a new tagsMode param when listing short URLs

This commit is contained in:
Alejandro Celaya
2022-01-04 12:11:47 +01:00
parent d0daeb0078
commit 103af2e2c1
7 changed files with 64 additions and 14 deletions

View File

@@ -14,11 +14,15 @@ use function Shlinkio\Shlink\Core\parseDateField;
final class ShortUrlsParams
{
public const DEFAULT_ITEMS_PER_PAGE = 10;
public const TAGS_MODE_ANY = 'any';
public const TAGS_MODE_ALL = 'all';
private int $page;
private int $itemsPerPage;
private ?string $searchTerm;
private array $tags;
/** @var self::TAGS_MODE_ANY|self::TAGS_MODE_ALL */
private string $tagsMode = self::TAGS_MODE_ANY;
private ShortUrlsOrdering $orderBy;
private ?DateRange $dateRange;
@@ -63,6 +67,7 @@ final class ShortUrlsParams
$this->itemsPerPage = (int) (
$inputFilter->getValue(ShortUrlsParamsInputFilter::ITEMS_PER_PAGE) ?? self::DEFAULT_ITEMS_PER_PAGE
);
$this->tagsMode = $inputFilter->getValue(ShortUrlsParamsInputFilter::TAGS_MODE) ?? self::TAGS_MODE_ANY;
}
public function page(): int
@@ -94,4 +99,12 @@ final class ShortUrlsParams
{
return $this->dateRange;
}
/**
* @return self::TAGS_MODE_ANY|self::TAGS_MODE_ALL
*/
public function tagsMode(): string
{
return $this->tagsMode;
}
}