TextAnonymizer.php in General Data Protection Regulation 8
Same filename and directory in other branches
Namespace
Drupal\anonymizer\Plugin\AnonymizerFile
modules/anonymizer/src/Plugin/Anonymizer/TextAnonymizer.phpView source
<?php
namespace Drupal\anonymizer\Plugin\Anonymizer;
use Drupal\anonymizer\Anonymizer\AnonymizerBase;
use Drupal\Core\Field\FieldItemListInterface;
/**
* Class TextAnonymizer.
*
* @Anonymizer(
* id = "text_anonymizer",
* label = @Translation("Text anonymizer"),
* description = @Translation("Provides anonymization functionality intended to be used for titles or short text.")
* )
*
* @package Drupal\anonymizer\Plugin\Anonymizer
*/
class TextAnonymizer extends AnonymizerBase {
/**
* {@inheritdoc}
*
* @throws \RuntimeException
*/
public function anonymize($input, FieldItemListInterface $field = NULL) {
return $this->faker
->generator()
->words(\str_word_count($input), TRUE);
}
}
Classes
Name | Description |
---|---|
TextAnonymizer | Class TextAnonymizer. |