Moved TagsMode to its own enum

This commit is contained in:
Alejandro Celaya
2022-04-23 18:56:27 +02:00
parent e8f7daac6f
commit 6ada704bc3
10 changed files with 64 additions and 49 deletions

View File

@@ -0,0 +1,13 @@
<?php
declare(strict_types=1);
// phpcs:disable
// TODO Enable coding style checks again once code sniffer 3.7 is released https://github.com/squizlabs/PHP_CodeSniffer/issues/3474
namespace Shlinkio\Shlink\Core\ShortUrl\Model;
enum TagsMode: string
{
case ANY = 'any';
case ALL = 'all';
}

View File

@@ -6,6 +6,7 @@ namespace Shlinkio\Shlink\Core\ShortUrl\Persistence;
use Shlinkio\Shlink\Common\Util\DateRange;
use Shlinkio\Shlink\Core\Model\ShortUrlsParams;
use Shlinkio\Shlink\Core\ShortUrl\Model\TagsMode;
use Shlinkio\Shlink\Rest\Entity\ApiKey;
class ShortUrlsCountFiltering
@@ -13,7 +14,7 @@ class ShortUrlsCountFiltering
public function __construct(
private ?string $searchTerm = null,
private array $tags = [],
private ?string $tagsMode = null,
private ?TagsMode $tagsMode = null,
private ?DateRange $dateRange = null,
private ?ApiKey $apiKey = null,
) {
@@ -34,7 +35,7 @@ class ShortUrlsCountFiltering
return $this->tags;
}
public function tagsMode(): ?string
public function tagsMode(): ?TagsMode
{
return $this->tagsMode;
}

View File

@@ -7,6 +7,7 @@ namespace Shlinkio\Shlink\Core\ShortUrl\Persistence;
use Shlinkio\Shlink\Common\Util\DateRange;
use Shlinkio\Shlink\Core\Model\Ordering;
use Shlinkio\Shlink\Core\Model\ShortUrlsParams;
use Shlinkio\Shlink\Core\ShortUrl\Model\TagsMode;
use Shlinkio\Shlink\Rest\Entity\ApiKey;
class ShortUrlsListFiltering extends ShortUrlsCountFiltering
@@ -17,7 +18,7 @@ class ShortUrlsListFiltering extends ShortUrlsCountFiltering
private Ordering $orderBy,
?string $searchTerm = null,
array $tags = [],
?string $tagsMode = null,
?TagsMode $tagsMode = null,
?DateRange $dateRange = null,
?ApiKey $apiKey = null,
) {