Skip to content

DirectiveExpander

Applies the same %core.quiote_dir%-style directive expansion and literal-boolean coercion that XML config values get “for free” via XmlConfigDomElement::getLiteralValue() (which runs Toolkit::literalize() on element text by default) — to PHP-array and YAML config values, which have no XML text-node equivalent to hook that into.

Without this, a YAML/PHP config author would have to write Config::getString('core.quiote_dir') . '/foo' themselves instead of the %core.quiote_dir%/foo string every existing XML config already uses, which would make migrating a config file from XML a breaking change in its own right rather than a drop-in format swap.

final class DirectiveExpander

Since1.0.0
SourceConfig/Format/DirectiveExpander.php
MethodDescription
expand(array<TKey, mixed> $config): array<TKey, mixed>Recursively expands every string leaf in $config via Toolkit::literalize() (directive expansion + “true”/“false”/“yes”/ “no”/etc.

public function expand(array<TKey, mixed> $config): array<TKey, mixed>

Recursively expands every string leaf in $config via Toolkit::literalize() (directive expansion + “true”/“false”/“yes”/ “no”/etc.

ParameterTypeDescription
$configarray``<``TKey``, ``mixed``>

Returns array``<``TKey``, ``mixed``> — A new array; $config is not mutated.