Added validateUrl optional flag for create/edit short URLs

This commit is contained in:
Alejandro Celaya
2020-09-23 19:19:17 +02:00
parent 1f78f5266a
commit d5eac3b1c3
11 changed files with 71 additions and 29 deletions

View File

@@ -27,10 +27,11 @@ class UrlValidator implements UrlValidatorInterface, RequestMethodInterface
/**
* @throws InvalidUrlException
*/
public function validateUrl(string $url): void
public function validateUrl(string $url, ?bool $doValidate): void
{
// If the URL validation is not enabled, skip check
if (! $this->options->isUrlValidationEnabled()) {
// If the URL validation is not enabled or it was explicitly set to not validate, skip check
$doValidate = $doValidate ?? $this->options->isUrlValidationEnabled();
if (! $doValidate) {
return;
}

View File

@@ -11,5 +11,5 @@ interface UrlValidatorInterface
/**
* @throws InvalidUrlException
*/
public function validateUrl(string $url): void;
public function validateUrl(string $url, ?bool $doValidate): void;
}