Skip to content

SettingConfigHandler

SettingConfigHandler handles the settings.xml file.

The compilation logic (executeArray()) consumes a plain array rather than walking the DOM, so the same logic compiles a settings.php or settings.yaml file (via Quiote\Config\Format\FormatDriverRegistry::forHandler()), not just XML.

The canonical array shape is a flat, dot-keyed map: ‘actions.{name}_module’ => string (from <system_action name=”…”>) ‘actions.{name}_action’ => string (from <system_action name=”…”>) ‘{prefix}{setting_name}’ => mixed (prefix defaults to ‘core.’; a wrapper overrides it for its children; the value is either a scalar/nested array from ae:parameters, or the setting’s literal text value)

A PHP-array or YAML settings file is simply this map written directly, e.g. return ['core.app_name' => 'Demo', 'core.debug' => true]; — there is no XML-specific concept (system_actions/settings/prefix wrappers) left to represent once you’re at this shape.

The compiled artifact returns that map; SettingConfigHandler::apply() is what feeds it to Config.

class SettingConfigHandler extends XmlConfigHandler implements IArrayConfigHandler, IDeclarationConfigHandler

ExtendsXmlConfigHandler
ImplementsIArrayConfigHandler, IDeclarationConfigHandler
Since1.0.0
SourceConfig/SettingConfigHandler.php
ConstantValueDescription
XML_NAMESPACE'http://quiote.dev/quiote/config/parts/settings/1.1'
MethodDescription
apply(mixed $declaration, string $sourceRef): voidFeed the declared settings into the configuration repository.
execute(XmlConfigDomDocument $document): mixedExecute this configuration handler.
executeArray(array $config, ?string $sourceRef = null): mixedReturns the flat setting map unchanged as the declaration to cache.
toCanonicalArray(XmlConfigDomDocument $document): arrayFlattens the document’s system actions and settings into the dot-keyed map described in this class’s summary.

public function apply(mixed $declaration, string $sourceRef): void

Feed the declared settings into the configuration repository.

The flat, dot-keyed map described in this class’s summary.

ParameterTypeDescription
$declarationmixedThe flat, dot-keyed map described in this class’s summary.
$sourceRefstring

public function execute(XmlConfigDomDocument $document): mixed

Execute this configuration handler.

The document to parse.

ParameterTypeDescription
$documentXmlConfigDomDocumentThe document to parse.

Returns mixed — The declaration to be cached.

ThrowsWhen
UnreadableExceptionIf a requested configuration file does not exist or is not readable.
ParseExceptionIf a requested configuration file is improperly formatted.

public function executeArray(array $config, ?string $sourceRef = null): mixed

Returns the flat setting map unchanged as the declaration to cache.

The map is already the compiled artifact; SettingConfigHandler::apply() is what later feeds it into Config.

ParameterTypeDescription
$configarray
$sourceRef?``string

Returns mixed

public function toCanonicalArray(XmlConfigDomDocument $document): array

Flattens the document’s system actions and settings into the dot-keyed map described in this class’s summary.

Each system action contributes an actions.{name}_module and an actions.{name}_action entry. Each setting is keyed by its name behind a prefix — core. unless an enclosing <settings prefix="..."> overrides it for its children — and takes either its nested parameters or its literalized text value.

ParameterTypeDescription
$documentXmlConfigDomDocument

Returns array

ThrowsWhen
ParseExceptionif a system action is missing its <module> or <action> child.

These come from an ancestor and are documented where they are declared.

MethodDeclared inDescription
appendParameter()ParameterHolderAppend a parameter.
appendParameterByRef()ParameterHolderAppend a parameter by reference.
clearParameters()ParameterHolderClear all parameters associated with this request.
getFlatParameterNames()ParameterHolderRetrieve an array of flattened parameter names.
getParameter()ParameterHolderRetrieve a parameter.
getParameterNames()ParameterHolderRetrieve an array of parameter names.
getParameters()ParameterHolderRetrieve an array of parameters.
hasParameter()ParameterHolderIndicates whether or not a parameter exists.
initialize()XmlConfigHandlerInitialize this ConfigHandler.
literalize()BaseConfigHandlerLiteralize a string value.
removeParameter()ParameterHolderRemove a parameter.
replaceConstants()BaseConfigHandlerReplace configuration directive identifiers in a string.
replacePath()BaseConfigHandlerReplace a relative filesystem path with an absolute one.
reset()ParameterHolderRemoves every parameter held, leaving the holder empty for reuse.
setParameter()ParameterHolderSet a parameter.
setParameterByRef()ParameterHolderSet a parameter by reference.
setParameters()ParameterHolderSet an array of parameters.
setParametersByRef()ParameterHolderSet an array of parameters by reference.