You are here

public function PasswordAnonymizer::anonymize in General Data Protection Regulation 3.0.x

Same name and namespace in other branches
  1. 8.2 modules/anonymizer/src/Plugin/Anonymizer/PasswordAnonymizer.php \Drupal\anonymizer\Plugin\Anonymizer\PasswordAnonymizer::anonymize()
  2. 8 modules/anonymizer/src/Plugin/Anonymizer/PasswordAnonymizer.php \Drupal\anonymizer\Plugin\Anonymizer\PasswordAnonymizer::anonymize()

Return an anonymized output.

The input. @var \Drupal\Core\Field\FieldItemListInterface|null $field The field being anonymized.

Return value

int|string The anonymized output.

Overrides AnonymizerInterface::anonymize

File

modules/anonymizer/src/Plugin/Anonymizer/PasswordAnonymizer.php, line 80

Class

PasswordAnonymizer
Class PasswordAnonymizer.

Namespace

Drupal\anonymizer\Plugin\Anonymizer

Code

public function anonymize($input, FieldItemListInterface $field = NULL) {

  // @todo Performance test for lots of data.
  return $this->password
    ->hash($this->faker
    ->generator()
    ->password(self::MIN_PASSWORD_LENGTH, self::MAX_PASSWORD_LENGTH));
}