mirror of
https://github.com/shlinkio/shlink.git
synced 2024-12-28 01:41:36 -06:00
Renamed class to a more appropriate name
This commit is contained in:
parent
bfb54189b8
commit
77fee1390f
@ -33,7 +33,7 @@ return [
|
||||
Service\ShortUrlService::class => ConfigAbstractFactory::class,
|
||||
Service\ShortUrl\DeleteShortUrlService::class => ConfigAbstractFactory::class,
|
||||
Service\ShortUrl\ShortUrlResolver::class => ConfigAbstractFactory::class,
|
||||
Service\ShortUrl\ShortCodeHelper::class => ConfigAbstractFactory::class,
|
||||
Service\ShortUrl\ShortCodeUniquenessHelper::class => ConfigAbstractFactory::class,
|
||||
|
||||
Tag\TagService::class => ConfigAbstractFactory::class,
|
||||
|
||||
@ -97,7 +97,7 @@ return [
|
||||
ShortUrl\Helper\ShortUrlTitleResolutionHelper::class,
|
||||
'em',
|
||||
ShortUrl\Resolver\PersistenceShortUrlRelationResolver::class,
|
||||
Service\ShortUrl\ShortCodeHelper::class,
|
||||
Service\ShortUrl\ShortCodeUniquenessHelper::class,
|
||||
],
|
||||
Visit\VisitsTracker::class => [
|
||||
'em',
|
||||
@ -120,7 +120,7 @@ return [
|
||||
Service\ShortUrl\ShortUrlResolver::class,
|
||||
],
|
||||
Service\ShortUrl\ShortUrlResolver::class => ['em'],
|
||||
Service\ShortUrl\ShortCodeHelper::class => ['em'],
|
||||
Service\ShortUrl\ShortCodeUniquenessHelper::class => ['em'],
|
||||
Domain\DomainService::class => ['em', 'config.url_shortener.domain.hostname'],
|
||||
|
||||
Util\UrlValidator::class => ['httpClient', Options\UrlShortenerOptions::class],
|
||||
@ -165,7 +165,7 @@ return [
|
||||
Importer\ImportedLinksProcessor::class => [
|
||||
'em',
|
||||
ShortUrl\Resolver\PersistenceShortUrlRelationResolver::class,
|
||||
Service\ShortUrl\ShortCodeHelper::class,
|
||||
Service\ShortUrl\ShortCodeUniquenessHelper::class,
|
||||
Util\DoctrineBatchHelper::class,
|
||||
],
|
||||
|
||||
|
@ -8,7 +8,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
use Shlinkio\Shlink\Core\Entity\ShortUrl;
|
||||
use Shlinkio\Shlink\Core\Exception\NonUniqueSlugException;
|
||||
use Shlinkio\Shlink\Core\Repository\ShortUrlRepositoryInterface;
|
||||
use Shlinkio\Shlink\Core\Service\ShortUrl\ShortCodeHelperInterface;
|
||||
use Shlinkio\Shlink\Core\Service\ShortUrl\ShortCodeUniquenessHelperInterface;
|
||||
use Shlinkio\Shlink\Core\ShortUrl\Resolver\ShortUrlRelationResolverInterface;
|
||||
use Shlinkio\Shlink\Core\Util\DoctrineBatchHelperInterface;
|
||||
use Shlinkio\Shlink\Importer\ImportedLinksProcessorInterface;
|
||||
@ -25,7 +25,7 @@ class ImportedLinksProcessor implements ImportedLinksProcessorInterface
|
||||
public function __construct(
|
||||
private EntityManagerInterface $em,
|
||||
private ShortUrlRelationResolverInterface $relationResolver,
|
||||
private ShortCodeHelperInterface $shortCodeHelper,
|
||||
private ShortCodeUniquenessHelperInterface $shortCodeHelper,
|
||||
private DoctrineBatchHelperInterface $batchHelper,
|
||||
) {
|
||||
$this->shortUrlRepo = $this->em->getRepository(ShortUrl::class);
|
||||
|
@ -9,7 +9,7 @@ use Shlinkio\Shlink\Core\Entity\ShortUrl;
|
||||
use Shlinkio\Shlink\Core\Model\ShortUrlIdentifier;
|
||||
use Shlinkio\Shlink\Core\Repository\ShortUrlRepository;
|
||||
|
||||
class ShortCodeHelper implements ShortCodeHelperInterface // TODO Rename to ShortCodeUniquenessHelper
|
||||
class ShortCodeUniquenessHelper implements ShortCodeUniquenessHelperInterface
|
||||
{
|
||||
public function __construct(private EntityManagerInterface $em)
|
||||
{
|
@ -6,7 +6,7 @@ namespace Shlinkio\Shlink\Core\Service\ShortUrl;
|
||||
|
||||
use Shlinkio\Shlink\Core\Entity\ShortUrl;
|
||||
|
||||
interface ShortCodeHelperInterface // TODO Rename to ShortCodeUniquenessHelperInterface
|
||||
interface ShortCodeUniquenessHelperInterface
|
||||
{
|
||||
public function ensureShortCodeUniqueness(ShortUrl $shortUrlToBeCreated, bool $hasCustomSlug): bool;
|
||||
}
|
@ -10,7 +10,7 @@ use Shlinkio\Shlink\Core\Exception\InvalidUrlException;
|
||||
use Shlinkio\Shlink\Core\Exception\NonUniqueSlugException;
|
||||
use Shlinkio\Shlink\Core\Model\ShortUrlMeta;
|
||||
use Shlinkio\Shlink\Core\Repository\ShortUrlRepositoryInterface;
|
||||
use Shlinkio\Shlink\Core\Service\ShortUrl\ShortCodeHelperInterface;
|
||||
use Shlinkio\Shlink\Core\Service\ShortUrl\ShortCodeUniquenessHelperInterface;
|
||||
use Shlinkio\Shlink\Core\ShortUrl\Helper\ShortUrlTitleResolutionHelperInterface;
|
||||
use Shlinkio\Shlink\Core\ShortUrl\Resolver\ShortUrlRelationResolverInterface;
|
||||
|
||||
@ -20,7 +20,7 @@ class UrlShortener implements UrlShortenerInterface
|
||||
private ShortUrlTitleResolutionHelperInterface $titleResolutionHelper,
|
||||
private EntityManagerInterface $em,
|
||||
private ShortUrlRelationResolverInterface $relationResolver,
|
||||
private ShortCodeHelperInterface $shortCodeHelper,
|
||||
private ShortCodeUniquenessHelperInterface $shortCodeHelper,
|
||||
) {
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@ use Shlinkio\Shlink\Core\Entity\ShortUrl;
|
||||
use Shlinkio\Shlink\Core\Entity\Visit;
|
||||
use Shlinkio\Shlink\Core\Importer\ImportedLinksProcessor;
|
||||
use Shlinkio\Shlink\Core\Repository\ShortUrlRepositoryInterface;
|
||||
use Shlinkio\Shlink\Core\Service\ShortUrl\ShortCodeHelperInterface;
|
||||
use Shlinkio\Shlink\Core\Service\ShortUrl\ShortCodeUniquenessHelperInterface;
|
||||
use Shlinkio\Shlink\Core\ShortUrl\Resolver\SimpleShortUrlRelationResolver;
|
||||
use Shlinkio\Shlink\Core\Util\DoctrineBatchHelperInterface;
|
||||
use Shlinkio\Shlink\Importer\Model\ImportedShlinkUrl;
|
||||
@ -46,7 +46,7 @@ class ImportedLinksProcessorTest extends TestCase
|
||||
$this->repo = $this->prophesize(ShortUrlRepositoryInterface::class);
|
||||
$this->em->getRepository(ShortUrl::class)->willReturn($this->repo->reveal());
|
||||
|
||||
$this->shortCodeHelper = $this->prophesize(ShortCodeHelperInterface::class);
|
||||
$this->shortCodeHelper = $this->prophesize(ShortCodeUniquenessHelperInterface::class);
|
||||
$batchHelper = $this->prophesize(DoctrineBatchHelperInterface::class);
|
||||
$batchHelper->wrapIterable(Argument::cetera())->willReturnArgument(0);
|
||||
|
||||
|
@ -12,20 +12,20 @@ use Shlinkio\Shlink\Core\Entity\Domain;
|
||||
use Shlinkio\Shlink\Core\Entity\ShortUrl;
|
||||
use Shlinkio\Shlink\Core\Model\ShortUrlIdentifier;
|
||||
use Shlinkio\Shlink\Core\Repository\ShortUrlRepository;
|
||||
use Shlinkio\Shlink\Core\Service\ShortUrl\ShortCodeHelper;
|
||||
use Shlinkio\Shlink\Core\Service\ShortUrl\ShortCodeUniquenessHelper;
|
||||
|
||||
class ShortCodeHelperTest extends TestCase
|
||||
class ShortCodeUniquenessHelperTest extends TestCase
|
||||
{
|
||||
use ProphecyTrait;
|
||||
|
||||
private ShortCodeHelper $helper;
|
||||
private ShortCodeUniquenessHelper $helper;
|
||||
private ObjectProphecy $em;
|
||||
private ObjectProphecy $shortUrl;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->em = $this->prophesize(EntityManagerInterface::class);
|
||||
$this->helper = new ShortCodeHelper($this->em->reveal());
|
||||
$this->helper = new ShortCodeUniquenessHelper($this->em->reveal());
|
||||
|
||||
$this->shortUrl = $this->prophesize(ShortUrl::class);
|
||||
$this->shortUrl->getShortCode()->willReturn('abc123');
|
@ -14,7 +14,7 @@ use Shlinkio\Shlink\Core\Entity\ShortUrl;
|
||||
use Shlinkio\Shlink\Core\Exception\NonUniqueSlugException;
|
||||
use Shlinkio\Shlink\Core\Model\ShortUrlMeta;
|
||||
use Shlinkio\Shlink\Core\Repository\ShortUrlRepository;
|
||||
use Shlinkio\Shlink\Core\Service\ShortUrl\ShortCodeHelperInterface;
|
||||
use Shlinkio\Shlink\Core\Service\ShortUrl\ShortCodeUniquenessHelperInterface;
|
||||
use Shlinkio\Shlink\Core\Service\UrlShortener;
|
||||
use Shlinkio\Shlink\Core\ShortUrl\Helper\ShortUrlTitleResolutionHelperInterface;
|
||||
use Shlinkio\Shlink\Core\ShortUrl\Resolver\SimpleShortUrlRelationResolver;
|
||||
@ -48,7 +48,7 @@ class UrlShortenerTest extends TestCase
|
||||
$repo = $this->prophesize(ShortUrlRepository::class);
|
||||
$this->em->getRepository(ShortUrl::class)->willReturn($repo->reveal());
|
||||
|
||||
$this->shortCodeHelper = $this->prophesize(ShortCodeHelperInterface::class);
|
||||
$this->shortCodeHelper = $this->prophesize(ShortCodeUniquenessHelperInterface::class);
|
||||
$this->shortCodeHelper->ensureShortCodeUniqueness(Argument::cetera())->willReturn(true);
|
||||
|
||||
$this->urlShortener = new UrlShortener(
|
||||
|
Loading…
Reference in New Issue
Block a user