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.
Synopsis
Section titled “Synopsis”final readonly class OutputTypeDefinitions
| Since | 4.0.0 |
| Source | Controller/OutputTypeDefinitions.php |
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
$default | ?``string | readonly. |
$outputTypes | array | readonly. |
Constructor
Section titled “Constructor”__construct()
Section titled “__construct()”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.
| Parameter | Type | Description |
|---|---|---|
$outputTypes | 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}``> | Keyed by output-type name, in declaration order. |
$default | ?``string | 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. |
Returns mixed
Methods
Section titled “Methods”| Method | Description |
|---|---|
fromCompiled(mixed $compiled, string $source = 'the compiled output_types cache'): OutputTypeDefinitions | Read a compiled declaration, rejecting anything malformed. |
fromCompiled()
Section titled “fromCompiled()”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.
| Parameter | Type | Description |
|---|---|---|
$compiled | mixed | Whatever the compiled file returned. |
$source | string |
Returns OutputTypeDefinitions
| Throws | When |
|---|---|
ConfigurationException | When $compiled is not a declaration this version understands — most likely a cache compiled by an earlier one. |