Added mechanisms to be able to provide the API key when creating a short URL

This commit is contained in:
Alejandro Celaya
2020-11-07 09:31:46 +01:00
parent 97f89bcede
commit 2732b05834
11 changed files with 113 additions and 25 deletions

View File

@@ -24,6 +24,7 @@ final class ShortUrlMeta
private ?string $domain = null;
private int $shortCodeLength = 5;
private ?bool $validateUrl = null;
private ?string $apiKey = null;
// Enforce named constructors
private function __construct()
@@ -66,6 +67,7 @@ final class ShortUrlMeta
$inputFilter,
ShortUrlMetaInputFilter::SHORT_CODE_LENGTH,
) ?? DEFAULT_SHORT_CODES_LENGTH;
$this->apiKey = $inputFilter->getValue(ShortUrlMetaInputFilter::API_KEY);
}
public function getValidSince(): ?Chronos
@@ -132,4 +134,9 @@ final class ShortUrlMeta
{
return $this->validateUrl;
}
public function getApiKey(): ?string
{
return $this->apiKey;
}
}