You are here

EmailAnonymizer.php in General Data Protection Regulation 3.0.x

File

modules/anonymizer/src/Plugin/Anonymizer/EmailAnonymizer.php
View source
<?php

namespace Drupal\anonymizer\Plugin\Anonymizer;

use Drupal\anonymizer\Anonymizer\AnonymizerBase;
use Drupal\Core\Field\FieldItemListInterface;

/**
 * Class EmailAnonymizer.
 *
 * @Anonymizer(
 *   id = "email_anonymizer",
 *   label = @Translation("Email anonymizer"),
 *   description = @Translation("Provides anonymization functionality intended to be used for emails.")
 * )
 *
 * @package Drupal\anonymizer\Plugin\Anonymizer
 */
class EmailAnonymizer extends AnonymizerBase {

  /**
   * {@inheritdoc}
   */
  public function anonymize($input, FieldItemListInterface $field = NULL) {
    return $this->faker
      ->generator()
      ->unique()->safeEmail;
  }

}

Classes

Namesort descending Description
EmailAnonymizer Class EmailAnonymizer.