VERSION
VERSION = 1
Format version written into every profile.
A portable set of classification decisions.
Deciding what a site's ephemeral keyspace is for is real work, done once per site by someone who understands the modules on it. Two things make that work worth exporting: a staging site and a production site running the same modules need the same answers, and a module maintainer can ship the answers for their own namespaces so nobody has to rediscover them.
Only decisions travel. Observed key and byte counts are properties of one site's traffic and mean nothing on another, so they are left behind rather than carried across and believed.
An imported profile does not overwrite a local human decision by default. Someone who looked at their own site and chose an answer outranks a file, and a profile that silently reversed that would be worse than no profile at all.
__construct(array$decisions = [], string $label = '', int $version = \self::VERSION) : mixed
Constructs a profile.
| array |
$decisions | Pattern keyed to its classification. |
| string | $label | What this profile is, such as "earth-app production" or "commerce defaults". |
| int | $version | Format version. |
fromRegistry(\Drupal\strata\Capture\Classifier\ClassificationRegistry $registry, string $label = '', bool $humanOnly = true) : self
Builds a profile from what a registry holds.
| \Drupal\strata\Capture\Classifier\ClassificationRegistry | $registry | The registry to read. |
| string | $label | What to call the profile. |
| bool | $humanOnly | TRUE to export only what a person decided, which is the useful default: a heuristic's answer is re-derived on the target site anyway, and exporting it would freeze this release's rules into a file that outlives them. |
The profile.
applyTo(\Drupal\strata\Capture\Classifier\ClassificationRegistry $registry, bool $overwriteLocal = false) : array{applied: int, kept: int}
Applies this profile to a registry.
| \Drupal\strata\Capture\Classifier\ClassificationRegistry | $registry | The registry to write into. |
| bool | $overwriteLocal | TRUE to replace a decision a person made on this site. FALSE, the default, keeps it. |
How many decisions were written and how many local ones were left alone.
fromArray(array$data) : self
Reads a profile back.
A pattern whose classification this release does not know is skipped rather than guessed at, so a profile written by a later version loads what it can and says nothing about the rest.
| array |
$data | The array produced by ClassificationProfile::jsonSerialize(). |
When the version is one this release cannot read.
The profile.