public static function HostValidator::isValidHost in Content-Security-Policy 8
Verifies the syntax of the given URL.
Similar to UrlHelper::isValid(), except:
- protocol is optional; can only be http/https, or ws/wss.
- domains must have at least a top-level and secondary domain.
- an initial subdomain wildcard is allowed
- wildcard is allowed as port value
- query is not allowed.
Parameters
string $url: The URL to verify.
Return value
bool TRUE if the URL is in a valid format, FALSE otherwise.
Overrides CspSettingsForm::isValidHost
1 call to HostValidator::isValidHost()
- CspSettingsFormTest::testIsValidHost in tests/
src/ Unit/ Form/ CspSettingsFormTest.php - Valid host source values.
File
- tests/
src/ Unit/ Form/ CspSettingsFormTest.php, line 98
Class
Namespace
Drupal\Tests\csp\Unit\FormCode
public static function isValidHost($url) : bool {
return parent::isValidHost($url);
}