Anonymizer
MMO\mongodb · 1 symbole · générée le 30 Nov 2026
Anonymizer
Anonymizer.php:43A pseudonymised copy of a database (ISO/IEC 27001 A.8.11, A.8.33): what a developer's machine gets instead of a client's data. Driven by the classification of the entities (Classification): each value of a document is read with the level of its path (Schema::classificationOf), and only personnel and sante values change.
- Espace de noms
MMO\mongodb- Utilise les traits
- tSingleton
Index
| KEEP_KEYS | the keys kept whatever their level: ids, references, the framework's own fields | |
| MARKER | the collection of the copy that says it is one: from what, when, with which key (its fingerprint) | |
| TRIES | the tries at a pseudonym that matches the pattern of its schema (a NIR's first digit) | |
| VERSION | ||
| actions | ||
| batch | ||
| empty | ||
| keep | ||
| key | ||
| keyFile | ||
| unclassified | ||
| words | ||
| action($path, $collection, $schema) | What is done to the values of a path (cached per collection and path, its indexes as 0): keep, date (moved), words (personnel), text (sante), with the pattern of its schema | |
| anonymize($repository, $from, $to, $replace, $dryRun, $overwrite, $progress) | Copy $from into $to, pseudonymised. | |
| copyCollection($repository, $from, $to, $name, $dryRun) | ||
| document($document, $collection, $schema, $stats) | A document pseudonymised (value for each of its values) | |
| Instantiate($config) static | (Re)create the shared instance immediately, configured with $config merged into the class's existing config. | |
| IsShared() static | ||
| key() | ||
| keyId() | ||
| marker($repository, $database) | ||
| pseudonym($value, $action, $pattern) | ||
| setKey($key) | ||
| shape($original, $bytes) | ||
| Shared() static | Get the shared instance, creating (and configuring) it on first call. | |
| shiftDays() | ||
| shiftString($value) | ||
| stream($seed, $length) | ||
| text($value) | ||
| Unshare($serialize) static | Remove the shared instance, so the next Shared() call creates a fresh one. | |
| value($value, $path, $collection, $schema, $stats) | ||
| words($value) |
Constantes4
KEEP_KEYS
the keys kept whatever their level: ids, references, the framework's own fields
MARKER
the collection of the copy that says it is one: from what, when, with which key (its fingerprint)
TRIES
the tries at a pseudonym that matches the pattern of its schema (a NIR's first digit)
VERSION
Propriétés8
actions
- Type
- array
batch
- Type
- int
empty
- Type
- array
keep
- Type
- array
key
keyFile
- Type
- string
unclassified
- Type
- string
words
- Type
- array
Méthodes20
action($path, $collection, $schema)
Anonymizer.php:327What is done to the values of a path (cached per collection and path, its indexes as 0): keep, date (moved), words (personnel), text (sante), with the pattern of its schema
anonymize($repository, $from, $to, $replace, $dryRun, $overwrite, $progress)
Anonymizer.php:124Copy $from into $to, pseudonymised.
| $repository | MongoRepository | the server, and the entities of the collections (their classification) |
| $from | string | the database read (never written) |
| $to | string | the database written: a new one, or an anonymised copy with $replace |
| $replace = false | bool | drop $to first when it is an anonymised copy (its marker); a database without one is refused |
| $dryRun = false | bool | read and count, write nothing |
| $overwrite = false | bool | drop $to first whatever it holds: BackupTask's restore here, which replaced the local database before it was anonymised; never from the command line |
| $progress = null | null | callable | fn(string $collection, array $stats) after each collection |
| retourne | array | string, to: string, dryRun: bool, documents: int, seconds: float, collections: array<string, array<string, mixed>>} |
| lève | when $to is $from, or a database that may not be written |
copyCollection($repository, $from, $to, $name, $dryRun)
Anonymizer.php:180document($document, $collection, $schema, $stats)
Anonymizer.php:245A document pseudonymised (value for each of its values)
| $document | array | |
| $collection | string | |
| $schema | null | Schema | its entity's, null for a collection of no known entity |
| $stats = [] | array | |
| retourne | array | mixed> |
Instantiate($config)
statictSingleton.php:66(Re)create the shared instance immediately, configured with $config merged into the class's existing config.
| $config = [] | array | config values merged in before the instance is constructed |
| retourne | static | the newly (re)created shared instance |
IsShared()
statictSingleton.php:54| retourne | bool | true if the shared instance has already been created (a call to Shared() would not need to construct a new one) |
key()
Anonymizer.php:86keyId()
Anonymizer.php:101| retourne | string | what identifies the key in a marker, not the key: the start of its hash |
marker($repository, $database)
Anonymizer.php:164| $repository | MongoRepository | |
| $database | string | |
| retourne | null | array | mixed>|null the marker of an anonymised copy, null for any other database |
pseudonym($value, $action, $pattern)
Anonymizer.php:309setKey($key)
Anonymizer.php:76shape($original, $bytes)
Anonymizer.php:401Shared()
statictSingleton.php:22Get the shared instance, creating (and configuring) it on first call.
| retourne | static |
shiftDays()
Anonymizer.php:106| retourne | int | the days every date of a copy is moved back by: whole weeks, 1 to 52, the key's |
shiftString($value)
Anonymizer.php:378stream($seed, $length)
Anonymizer.php:390text($value)
Anonymizer.php:370Unshare($serialize)
statictSingleton.php:40Remove the shared instance, so the next Shared() call creates a fresh one.
- Voir
serialize) and kept as the class's config, so the next instance created picks up where this one left off; if false, the instance is simply discarded and the next one starts from the class's original config
| $serialize = true | bool | if true (the default) and an instance currently exists, it is serialized first (via |
| retourne | bool | true if an instance actually existed and was removed |
value($value, $path, $collection, $schema, $stats)
Anonymizer.php:261words($value)
Anonymizer.php:355| $value | string | |
| retourne | string | $value, each word replaced by its pseudonym (the same word, the same pseudonym, whatever its case) |