You are here

public function TextAnonymizer::anonymize in General Data Protection Regulation 8

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

Throws

\RuntimeException

Overrides AnonymizerInterface::anonymize

File

modules/anonymizer/src/Plugin/Anonymizer/TextAnonymizer.php, line 26

Class

TextAnonymizer
Class TextAnonymizer.

Namespace

Drupal\anonymizer\Plugin\Anonymizer

Code

public function anonymize($input, FieldItemListInterface $field = NULL) {
  return $this->faker
    ->generator()
    ->words(\str_word_count($input), TRUE);
}