AbstractArrayFormatDriver
Shared parent-chain and imports resolution for array-shaped formats (PHP arrays, YAML).
Each format only has to implement parse(): raw array in, everything else — directive expansion, imports, parent — behaves identically regardless of which format produced the array.
Unlike XmlFormatDriver, $environment/$context are not applied here: PHP-array/YAML files have no native equivalent of XML’s <ae:configuration environment="..."> filtering. A config author who needs environment-conditional values in a PHP-array file can already express that directly (Config::getNullableString('core.environment') === 'test' inside the returned array’s construction) — that’s a deliberate scope limit, not an oversight.
Synopsis
Section titled “Synopsis”abstract class AbstractArrayFormatDriver implements FormatDriverInterface
| Implements | FormatDriverInterface |
| Since | 1.0.0 |
| Source | Config/Format/AbstractArrayFormatDriver.php |
Constructor
Section titled “Constructor”__construct()
Section titled “__construct()”public function __construct(ArrayMergeStrategy $merger = new ArrayMergeStrategy(…), DirectiveExpander $expander = new DirectiveExpander(…)): mixed
| Parameter | Type | Description |
|---|---|---|
$merger | ArrayMergeStrategy | |
$expander | DirectiveExpander |
Returns mixed
Methods
Section titled “Methods”| Method | Description |
|---|---|
| [`load(string $path, string $environment, string | null $context = null): array<string, mixed>`](#load) |
parse(string $path): array<string, mixed> | |
setRegistry(FormatDriverRegistry $registry): void | Called by FormatDriverRegistry when this driver is registered, so parent/imports references can be resolved through any registered format, not just this driver’s own. |
load()
Section titled “load()”public function load(string $path, string $environment, string|null $context = null): array<string, mixed>
The active context name, if any.
| Parameter | Type | Description |
|---|---|---|
$path | string | |
$environment | string | The active environment name (only meaningful to drivers whose format has a native environment-filtering concept, e.g. XmlFormatDriver; array/YAML drivers ignore it today — see class docs). |
$context | `string“ | “null` |
Returns array``<``string``, ``mixed``> — The resolved, parent-chain-merged, directive-expanded config data.
parse()
Section titled “parse()”abstract protected function parse(string $path): array<string, mixed>
| Parameter | Type | Description |
|---|---|---|
$path | string |
Returns array``<``string``, ``mixed``> — The raw, un-expanded array as read from $path (e.g. the value required from a PHP file, or the parsed YAML document). May contain ‘parent’ and/or ‘imports’ keys, which load() strips before returning.
setRegistry()
Section titled “setRegistry()”public function setRegistry(FormatDriverRegistry $registry): void
Called by FormatDriverRegistry when this driver is registered, so parent/imports references can be resolved through any registered format, not just this driver’s own.
| Parameter | Type | Description |
|---|---|---|
$registry | FormatDriverRegistry |
Inherited methods
Section titled “Inherited methods”These come from an ancestor and are documented where they are declared.
| Method | Declared in | Description |
|---|---|---|
supports() | FormatDriverInterface | Whether this driver can handle the given path, based on its extension. |