mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-11 17:44:44 +08:00
Refactored UrlShortener public method to receibe DTOs instead of primitive params
This commit is contained in:
@@ -17,11 +17,11 @@ final class CreateShortUrlData
|
||||
public function __construct(
|
||||
UriInterface $longUrl,
|
||||
array $tags = [],
|
||||
ShortUrlMeta $meta = null
|
||||
?ShortUrlMeta $meta = null
|
||||
) {
|
||||
$this->longUrl = $longUrl;
|
||||
$this->tags = $tags;
|
||||
$this->meta = $meta ?? ShortUrlMeta::createFromParams();
|
||||
$this->meta = $meta ?? ShortUrlMeta::createEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -138,4 +138,12 @@ final class ShortUrlMeta
|
||||
{
|
||||
return $this->maxVisits !== null;
|
||||
}
|
||||
|
||||
public function withCustomSlug(string $customSlug): self
|
||||
{
|
||||
$clone = clone $this;
|
||||
$clone->customSlug = $customSlug;
|
||||
|
||||
return $clone;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user