ModuleRegistry
Always use the ModuleProvider API to access modules
Table of Contents
Methods
- __construct() : mixed
- getModule() : ModuleInterface
- getModuleAliases() : array<string|int, mixed>
- getModules() : array<string|int, ModuleInterface>
- hasModule() : bool
- registerRoutesForModules() : void
- Needs to be called when the router is set up, AFTER all modules are loaded.
- applyHierarchy() : array<string|int, ModuleInterface>
- Applies sorting (based on the "position" configuration) to all registered modules and resolves the hierarchy (creating relations by attaching modules to the $parentModule and $subModules properties).
- applySorting() : array<string|int, ModuleInterface>
- Ensures that modules within one level of hierarchy are ordered properly the way they were given respecting their "top", "bottom", "before" or "after" definition.
- flattenModules() : array<string|int, mixed>
- Create a flat modules array (looping through each level by calling "getSubmodules()" on the parent)
- populateAliasMapping() : void
- populateOrderingsForDependencies() : array<string|int, mixed>
- Given module identifiers are added based on their module position information to the $alreadyOrderedModuleIdentifiers array (if not already present). In case the modules to be added have dependencies to other modules and those modules exist, corresponding modules are added to $alreadyOrderedModuleIdentifiers on the correct position as well.
Methods
__construct()
public
__construct(array<string|int, ModuleInterface> $modules) : mixed
Parameters
- $modules : array<string|int, ModuleInterface>
getModule()
public
getModule(string $identifier) : ModuleInterface
Parameters
- $identifier : string
Return values
ModuleInterfacegetModuleAliases()
public
getModuleAliases() : array<string|int, mixed>
Return values
array<string|int, mixed>getModules()
public
getModules() : array<string|int, ModuleInterface>
Return values
array<string|int, ModuleInterface>hasModule()
public
hasModule(string $identifier) : bool
Parameters
- $identifier : string
Return values
boolregisterRoutesForModules()
Needs to be called when the router is set up, AFTER all modules are loaded.
public
registerRoutesForModules(Router $router) : void
Parameters
- $router : Router
applyHierarchy()
Applies sorting (based on the "position" configuration) to all registered modules and resolves the hierarchy (creating relations by attaching modules to the $parentModule and $subModules properties).
protected
applyHierarchy(array<string|int, ModuleInterface> $modules) : array<string|int, ModuleInterface>
Parameters
- $modules : array<string|int, ModuleInterface>
Return values
array<string|int, ModuleInterface>applySorting()
Ensures that modules within one level of hierarchy are ordered properly the way they were given respecting their "top", "bottom", "before" or "after" definition.
protected
applySorting(array<string|int, ModuleInterface> $modules) : array<string|int, ModuleInterface>
Parameters
- $modules : array<string|int, ModuleInterface>
Return values
array<string|int, ModuleInterface>flattenModules()
Create a flat modules array (looping through each level by calling "getSubmodules()" on the parent)
protected
flattenModules(array<string|int, mixed> $modules[, mixed $flatModules = [] ]) : array<string|int, mixed>
Parameters
- $modules : array<string|int, mixed>
- $flatModules : mixed = []
Return values
array<string|int, mixed>populateAliasMapping()
protected
populateAliasMapping() : void
populateOrderingsForDependencies()
Given module identifiers are added based on their module position information to the $alreadyOrderedModuleIdentifiers array (if not already present). In case the modules to be added have dependencies to other modules and those modules exist, corresponding modules are added to $alreadyOrderedModuleIdentifiers on the correct position as well.
protected
populateOrderingsForDependencies(array<string|int, mixed> $moduleIdentifiersToBeAdded, array<string|int, mixed> $modulePositionInformation[, array<string|int, mixed> $alreadyOrderedModuleIdentifiers = [] ]) : array<string|int, mixed>
Parameters
- $moduleIdentifiersToBeAdded : array<string|int, mixed>
- $modulePositionInformation : array<string|int, mixed>
- $alreadyOrderedModuleIdentifiers : array<string|int, mixed> = []