Skip to content

ModuleConfigHandler

ModuleConfigHandler reads module configuration files to determine the status of a module.

Migrated to IArrayConfigHandler (phase 2). Canonical schema: [‘enabled’ => bool, ‘settings’ => [‘fully_prefixed_setting_name’ => value]] Setting keys are already fully prefixed in the canonical array, exactly as the original DOM-walking code built them: ‘modules.${moduleName}.’ (a literal template string, ${moduleName} expanded at runtime — not module-specific data) by default, or whatever a wrapper specified instead. A PHP/YAML module file therefore writes keys like ‘modules.${moduleName}.some_setting’ (or a fully custom prefix) directly, same as the array XML already produces.

class ModuleConfigHandler extends XmlConfigHandler implements IArrayConfigHandler, IPositionAwareConfigHandler, ISchemaAwareConfigHandler

ExtendsXmlConfigHandler
ImplementsIArrayConfigHandler, IPositionAwareConfigHandler, ISchemaAwareConfigHandler
Since1.0.0
SourceConfig/ModuleConfigHandler.php
ConstantValueDescription
XML_NAMESPACE'http://quiote.dev/quiote/config/parts/module/1.1'
MethodDescription
applyDeclaration(mixed $declaration, string $moduleName, string $sourceRef): voidApply a module’s compiled declaration for the module it belongs to.
execute(XmlConfigDomDocument $document): mixedExecute this configuration handler.
[`executeArray(array{enabled?: bool, settings?: array<string, mixed>} $config, stringnull $sourceRef = null): mixed`](#executearray)
schema(): Rule“settings” is an open, dynamically-keyed flat map (fully-prefixed setting names -> mixed value, exactly like SettingConfigHandler’s own shape) — only its container structure is fixed, not its key names.
toCanonicalArray(XmlConfigDomDocument $document): array{enabled: bool, settings: array<string, mixed>}
toCanonicalArrayWithPositions(XmlConfigDomDocument $document, ElementPositionIndex $positions): array{data: array{enabled: bool, settings: array<string, mixed>}, positions: array<string, array{file: string, line: int}>}

public static function applyDeclaration(mixed $declaration, string $moduleName, string $sourceRef): void

Apply a module’s compiled declaration for the module it belongs to.

The module config file, for diagnostics.

ParameterTypeDescription
$declarationmixedThe declaration ModuleConfigHandler::executeArray() compiles.
$moduleNamestringThe module the declaration belongs to; lowercased for the keys.
$sourceRefstringThe module config file, for diagnostics.
ThrowsWhen
ConfigurationExceptionIf the declaration is not the compiled shape.

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
ParseExceptionIf a requested configuration file is improperly formatted.

public function executeArray(array{enabled?: bool, settings?: array<string, mixed>} $config, string|null $sourceRef = null): mixed

Origin reference for the compiled cache file’s header comment (a file path for any format; XML’s is $document->documentURI).

ParameterTypeDescription
$configarray{enabled?: bool, settings?: array<string, mixed>}The canonical config array, matching the shape returned by toCanonicalArray().
$sourceRef`string““null`

Returns mixed — The declaration to be cached, exactly as IXmlConfigHandler::execute() returns.

public function schema(): Rule

“settings” is an open, dynamically-keyed flat map (fully-prefixed setting names -> mixed value, exactly like SettingConfigHandler’s own shape) — only its container structure is fixed, not its key names.

Returns Rule

public function toCanonicalArray(XmlConfigDomDocument $document): array{enabled: bool, settings: array<string, mixed>}

ParameterTypeDescription
$documentXmlConfigDomDocument

Returns array{enabled: bool, settings: array<string, mixed>}

public function toCanonicalArrayWithPositions(XmlConfigDomDocument $document, ElementPositionIndex $positions): array{data: array{enabled: bool, settings: array<string, mixed>}, positions: array<string, array{file: string, line: int}>}

ParameterTypeDescription
$documentXmlConfigDomDocument
$positionsElementPositionIndex

Returns array{data: array{enabled: bool, settings: array<string, mixed>}, positions: array<string, array{file: string, line: int}>}

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.