Modernize TitleResolutionModelInterface

This commit is contained in:
Alejandro Celaya
2026-04-02 11:37:51 +02:00
parent 8bcee302ea
commit 4c3ebdbeef
6 changed files with 5 additions and 15 deletions
+1 -1
View File
@@ -90,7 +90,7 @@ class ShortUrl extends AbstractEntity
$shortCodeLength = $creation->shortCodeLength;
return new self(
longUrl: $creation->getLongUrl(),
longUrl: $creation->longUrl,
shortCode: sprintf(
'%s%s',
$creation->pathPrefix ?? '',
@@ -60,7 +60,7 @@ readonly class ShortUrlTitleResolutionHelper implements ShortUrlTitleResolutionH
return $data;
}
$response = $this->fetchUrl($data->getLongUrl());
$response = $this->fetchUrl($data->longUrl ?? '');
if ($response === null) {
return $data;
}
@@ -6,9 +6,9 @@ namespace Shlinkio\Shlink\Core\ShortUrl\Helper;
interface TitleResolutionModelInterface
{
public function hasTitle(): bool;
public string|null $longUrl { get; }
public function getLongUrl(): string;
public function hasTitle(): bool;
public function withResolvedTitle(string $title): static;
}
@@ -97,11 +97,6 @@ final readonly class ShortUrlCreation implements TitleResolutionModelInterface
);
}
public function getLongUrl(): string
{
return $this->longUrl;
}
public function hasValidSince(): bool
{
return $this->validSince !== null;
@@ -93,11 +93,6 @@ final readonly class ShortUrlEdition implements TitleResolutionModelInterface
);
}
public function getLongUrl(): string
{
return $this->longUrl ?? '';
}
public function longUrlWasProvided(): bool
{
return $this->longUrlPropWasProvided && $this->longUrl !== null;
@@ -14,7 +14,7 @@ use function array_key_exists;
final readonly class DomainRedirectsRequest
{
private function __construct(
private(set) string $authority,
public string $authority,
private string|null $baseUrlRedirect = null,
private bool $baseUrlRedirectWasProvided = false,
private string|null $regular404Redirect = null,