You are here

public function Email::matches in User restrictions 8

Check if the given data matches the restriction.

Parameters

array $data: Data to check.

Return value

bool TRUE if the value matches one of the restrictions, FALSE otherwise.

Overrides UserRestrictionTypeInterface::matches

File

src/Plugin/UserRestrictionType/Email.php, line 26

Class

Email
Defines a restriction type by email.

Namespace

Drupal\user_restrictions\Plugin\UserRestrictionType

Code

public function matches(array $data) {
  if (!isset($data['mail'])) {
    return FALSE;
  }
  $this->mail = $data['mail'];
  $restriction = parent::matchesValue($this->mail);
  if ($restriction) {
    $this->logger
      ->notice('Restricted email %mail matching %restriction has been blocked.', [
      '%mail' => $this->mail,
      '%restriction' => $restriction
        ->toLink($restriction
        ->label(), 'edit-form'),
    ]);
  }
  return $restriction;
}