\Drupal\strata\Codec CodecProfile

Everything the settings form needs to say about one codec.

Three things together, because an administrator deciding whether a compressor is worth installing needs all three at once and none of them is useful alone: what it costs in size and speed, whether this machine can run it, and if not, the exact command that fixes that.

The reference measurements are shipped figures from a fixed Drupal-shaped corpus, so two hosts can be compared. They are NOT a promise about a particular site: ratio depends heavily on what the content is, and a corpus with a lot of hashes or already-compressed media will do worse than one that is mostly prose and repeated field structure. Calibrator measures the real thing on site data and marks those figures as such, and the form shows both.

Summary

Methods
Properties
Constants
__construct
measurement
isCalibrated
withMeasurements
jsonSerialize
id
label
summary
available
reason
supportsDictionary
perFrame
levels
measurements
install
documentation
No public constants found
No protected methods found
No protected properties found
No protected constants found
No private methods found
No private properties found
No private constants found

Properties

$id

$id : string

Type

string

$label

$label : string

Type

string

$summary

$summary : string

Type

string

$available

$available : bool

Type

bool

$reason

$reason : ?string

Type

string|null

$supportsDictionary

$supportsDictionary : bool

Type

bool

$perFrame

$perFrame : bool

Type

bool

$levels

$levels : array

Type

array<string|int, mixed>

$measurements

$measurements : array

Type

array<string|int, mixed>

$install

$install : array

Type

array<string|int, mixed>

$documentation

$documentation : ?string

Type

string|null

Methods

__construct()

__construct(string  $id, string  $label, string  $summary, bool  $available, string|null  $reason, bool  $supportsDictionary, bool  $perFrame, array{min: int, max: int, default: int, fast: int, dense: int}  $levels, list<\Drupal\strata\Codec\CodecMeasurement>  $measurements = [], array  $install = [], string|null  $documentation = null) : mixed

Constructs a profile.

Parameters

string $id

The codec id as recorded in a frame header.

string $label

Human-readable name for the form.

string $summary

One sentence on what this codec is for.

bool $available

Whether it can run on this host.

string|null $reason

Why it cannot run, or NULL when it can.

bool $supportsDictionary

Whether it accepts a trained dictionary, which is what delta coding needs.

bool $perFrame

Whether it may be chosen for the flush path, as opposed to bulk work only.

array{min: int, max: int, default: int, fast: int, dense: int} $levels

Its level range.

list<\Drupal\strata\Codec\CodecMeasurement> $measurements

Reference figures, and any measured on this host.

array $install

Platform label keyed to the command that installs it. Empty when it needs no install.

string|null $documentation

Where to read more, or NULL.

Returns

mixed —

measurement()

measurement(int  $frameSize, bool  $dictionary = false, string  $level = 'dense') : \Drupal\strata\Codec\CodecMeasurement|null

The measurement closest to a given frame size, preferring one taken on this host.

Parameters

int $frameSize

The frame size to report at.

bool $dictionary

Whether to report the dictionary figure.

string $level

One of "fast", "default" or "dense".

Returns

\Drupal\strata\Codec\CodecMeasurement|null —

The best matching measurement, or NULL when none was recorded.

isCalibrated()

isCalibrated() : bool

Whether any figure in this profile was measured here rather than shipped.

Returns

bool —

TRUE when calibration has run for this codec.

withMeasurements()

withMeasurements(list<\Drupal\strata\Codec\CodecMeasurement>  $measurements) : self

The same profile with extra measurements folded in.

Readonly, so calibration produces a new profile rather than mutating a shared one.

Parameters

list<\Drupal\strata\Codec\CodecMeasurement> $measurements

Measurements to add.

Returns

self —

A new profile carrying both sets.

jsonSerialize()

jsonSerialize() : array<string,mixed>

{@inheritdoc}

Returns

array

The profile as a plain array for a render array or a JSON response.