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

Breadcrumb

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

function MacAddress::__construct

Parameters

self::ALL*|self::LOCAL_*|self::UNIVERSAL_*|self::UNICAST_*|self::MULTICAST_*|self::BROADCAST $type A mac address type to validate (defaults to {@see self::ALL}):

Overrides Constraint::__construct

File

vendor/symfony/validator/Constraints/MacAddress.php, line 69

Class

MacAddress
Validates that a value is a valid MAC address.

Namespace

Symfony\Component\Validator\Constraints

Code

public function __construct(string $message = 'This value is not a valid MAC address.', string $type = self::ALL, ?callable $normalizer = null, ?array $groups = null, mixed $payload = null) {
    parent::__construct(null, $groups, $payload);
    if (!\in_array($this->type, self::TYPES, true)) {
        throw new ConstraintDefinitionException(\sprintf('The option "type" must be one of "%s".', implode('", "', self::TYPES)));
    }
    $this->normalizer = null !== $normalizer ? $normalizer(...) : null;
}

API Navigation

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