Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. FormatConstraint.php

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\Constraints

Code

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);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal