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
Synopsis
Section titled “Synopsis”class ModuleConfigHandler extends XmlConfigHandler implements IArrayConfigHandler, IPositionAwareConfigHandler, ISchemaAwareConfigHandler
| Extends | XmlConfigHandler |
| Implements | IArrayConfigHandler, IPositionAwareConfigHandler, ISchemaAwareConfigHandler |
| Since | 1.0.0 |
| Source | Config/ModuleConfigHandler.php |
Constants
Section titled “Constants”| Constant | Value | Description |
|---|---|---|
XML_NAMESPACE | 'http://quiote.dev/quiote/config/parts/module/1.1' |
Methods
Section titled “Methods”| Method | Description |
|---|---|
applyDeclaration(mixed $declaration, string $moduleName, string $sourceRef): void | Apply a module’s compiled declaration for the module it belongs to. |
execute(XmlConfigDomDocument $document): mixed | Execute this configuration handler. |
| [`executeArray(array{enabled?: bool, settings?: array<string, mixed>} $config, string | null $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}>} |
applyDeclaration()
Section titled “applyDeclaration()”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.
| Parameter | Type | Description |
|---|---|---|
$declaration | mixed | The declaration ModuleConfigHandler::executeArray() compiles. |
$moduleName | string | The module the declaration belongs to; lowercased for the keys. |
$sourceRef | string | The module config file, for diagnostics. |
| Throws | When |
|---|---|
ConfigurationException | If the declaration is not the compiled shape. |
execute()
Section titled “execute()”public function execute(XmlConfigDomDocument $document): mixed
Execute this configuration handler.
The document to parse.
| Parameter | Type | Description |
|---|---|---|
$document | XmlConfigDomDocument | The document to parse. |
Returns mixed — The declaration to be cached.
| Throws | When |
|---|---|
ParseException | If a requested configuration file is improperly formatted. |
executeArray()
Section titled “executeArray()”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).
| Parameter | Type | Description |
|---|---|---|
$config | array{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.
schema()
Section titled “schema()”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
toCanonicalArray()
Section titled “toCanonicalArray()”public function toCanonicalArray(XmlConfigDomDocument $document): array{enabled: bool, settings: array<string, mixed>}
| Parameter | Type | Description |
|---|---|---|
$document | XmlConfigDomDocument |
Returns array{enabled: bool, settings: array<string, mixed>}
toCanonicalArrayWithPositions()
Section titled “toCanonicalArrayWithPositions()”public function toCanonicalArrayWithPositions(XmlConfigDomDocument $document, ElementPositionIndex $positions): array{data: array{enabled: bool, settings: array<string, mixed>}, positions: array<string, array{file: string, line: int}>}
| Parameter | Type | Description |
|---|---|---|
$document | XmlConfigDomDocument | |
$positions | ElementPositionIndex |
Returns array{data: array{enabled: bool, settings: array<string, mixed>}, positions: array<string, array{file: string, line: int}>}
Inherited methods
Section titled “Inherited methods”These come from an ancestor and are documented where they are declared.
| Method | Declared in | Description |
|---|---|---|
appendParameter() | ParameterHolder | Append a parameter. |
appendParameterByRef() | ParameterHolder | Append a parameter by reference. |
clearParameters() | ParameterHolder | Clear all parameters associated with this request. |
getFlatParameterNames() | ParameterHolder | Retrieve an array of flattened parameter names. |
getParameter() | ParameterHolder | Retrieve a parameter. |
getParameterNames() | ParameterHolder | Retrieve an array of parameter names. |
getParameters() | ParameterHolder | Retrieve an array of parameters. |
hasParameter() | ParameterHolder | Indicates whether or not a parameter exists. |
initialize() | XmlConfigHandler | Initialize this ConfigHandler. |
literalize() | BaseConfigHandler | Literalize a string value. |
removeParameter() | ParameterHolder | Remove a parameter. |
replaceConstants() | BaseConfigHandler | Replace configuration directive identifiers in a string. |
replacePath() | BaseConfigHandler | Replace a relative filesystem path with an absolute one. |
reset() | ParameterHolder | Removes every parameter held, leaving the holder empty for reuse. |
setParameter() | ParameterHolder | Set a parameter. |
setParameterByRef() | ParameterHolder | Set a parameter by reference. |
setParameters() | ParameterHolder | Set an array of parameters. |
setParametersByRef() | ParameterHolder | Set an array of parameters by reference. |