function FormatConstraint::validateHostname
1 call to FormatConstraint::validateHostname()
- FormatConstraint::check in vendor/
justinrainbow/ json-schema/ src/ JsonSchema/ Constraints/ FormatConstraint.php - invokes the validation of an element
File
-
vendor/
justinrainbow/ json-schema/ src/ JsonSchema/ Constraints/ FormatConstraint.php, line 208
Class
- FormatConstraint
- Validates against the "format" property
Namespace
JsonSchema\ConstraintsCode
protected function validateHostname($host) {
$hostnameRegex = '/^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])$/i';
return preg_match($hostnameRegex, $host);
}