mirror of
https://github.com/shlinkio/shlink.git
synced 2026-08-03 01:49:28 -05:00
Modernize TitleResolutionModelInterface
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user