Skip to content

OutputTypeDefinitions

What the compiled output_types configuration declares, as data.

The compiled form used to be statements required inside Controller::initialize(), constructing each OutputType and assigning it into $this->outputTypes from a scope it had no business reaching. It is a declaration now, for the same reasons the compiled factories and databases configurations are — see FactoryDefinitions.

final readonly class OutputTypeDefinitions

Since4.0.0
SourceController/OutputTypeDefinitions.php
PropertyTypeDescription
$default?``stringreadonly.
$outputTypesarrayreadonly.

public function __construct(array<string, array{parameters: array<string, mixed>, renderers: array<string, array<string, mixed>>, defaultRenderer: ?string, layouts: array<string, array<string, mixed>>, defaultLayout: ?string, exceptionTemplate: ?string}> $outputTypes, ?string $default): mixed

The output type answered when none is named. Null is legal: a configuration may declare types without electing one, and Controller::getOutputType() falls back on its own terms.

ParameterTypeDescription
$outputTypesarray``<``string``, ``array{parameters: array<string, mixed>, renderers: array<string, array<string, mixed>>, defaultRenderer: ?string, layouts: array<string, array<string, mixed>>, defaultLayout: ?string, exceptionTemplate: ?string}``>Keyed by output-type name, in declaration order.
$default?``stringThe output type answered when none is named. Null is legal: a configuration may declare types without electing one, and Controller::getOutputType() falls back on its own terms.

Returns mixed

MethodDescription
fromCompiled(mixed $compiled, string $source = 'the compiled output_types cache'): OutputTypeDefinitionsRead a compiled declaration, rejecting anything malformed.

public static function fromCompiled(mixed $compiled, string $source = 'the compiled output_types cache'): OutputTypeDefinitions

Read a compiled declaration, rejecting anything malformed.

Whatever the compiled file returned.

ParameterTypeDescription
$compiledmixedWhatever the compiled file returned.
$sourcestring

Returns OutputTypeDefinitions

ThrowsWhen
ConfigurationExceptionWhen $compiled is not a declaration this version understands — most likely a cache compiled by an earlier one.