Documentation

ModuleManager
in package
Uses TEventDispatcher

Module Manager

Manages modules within the application.

Table of Contents

Properties

$instance  : ModuleManager
Singleton instance.
$list  : Collection
$settings  : Config
$_list  : Collection
List of modules.
$_settings  : object
Settings object.

Methods

__construct()  : mixed
Constructor.
__get()  : mixed
Magic method to handle property retrieval.
Config()  : Config
Gets the configuration of a module.
Create()  : ModuleManager
Static constructor for creating a singleton instance.
DispatchEvent()  : object|null
Dispatches an event.
Get()  : mixed
Retrieves a module by name.
GetPaths()  : array<string|int, string>
Retrieves paths of modules.
GetPathsFromModuleConfig()  : array<string|int, string>
Retrieves paths of modules from module configurations.
GetPermissions()  : array<string|int, mixed>
Retrieves the permissions of all modules.
GetTemplates()  : array<string|int, string>
Retrieves templates of modules.
HandleEvent()  : self
Adds an event handler.
Initialize()  : void
Initializes the module manager.
InitModule()  : Module|null
Initializes a module.
RemoveHandler()  : self
Removes an event handler.

Properties

Methods

__get()

Magic method to handle property retrieval.

public __get(string $property) : mixed
Parameters
$property : string

The name of the property to retrieve.

Tags
magic
Return values
mixed

The value of the property.

Config()

Gets the configuration of a module.

public Config(string $name) : Config
Parameters
$name : string

The name of the module.

Return values
Config

The configuration of the module.

DispatchEvent()

Dispatches an event.

public DispatchEvent(string|Event $event[, mixed $args = null ][, bool $async = false ]) : object|null
Parameters
$event : string|Event

The event object or its name.

$args : mixed = null

Additional arguments to pass to the event handlers.

$async : bool = false

Whether to dispatch the event asynchronously.

Return values
object|null

The event object with updated arguments, or null if the event does not exist.

Get()

Retrieves a module by name.

public Get(string $moduleName) : mixed
Parameters
$moduleName : string

The name of the module.

Return values
mixed

The module corresponding to the provided name.

GetPaths()

Retrieves paths of modules.

public GetPaths([string $extend = '/' ][, array<string|int, mixed>|null $extendArray = null ]) : array<string|int, string>
Parameters
$extend : string = '/'

String to append to each path.

$extendArray : array<string|int, mixed>|null = null

Additional elements to append to each path.

Return values
array<string|int, string>

Paths of modules.

GetPathsFromModuleConfig()

Retrieves paths of modules from module configurations.

public GetPathsFromModuleConfig([array<string|int, mixed>|null $extendArray = null ]) : array<string|int, string>
Parameters
$extendArray : array<string|int, mixed>|null = null

Additional elements to append to each path.

Return values
array<string|int, string>

Paths of modules.

GetPermissions()

Retrieves the permissions of all modules.

public GetPermissions() : array<string|int, mixed>
Return values
array<string|int, mixed>

The permissions of all modules.

GetTemplates()

Retrieves templates of modules.

public GetTemplates([string $templateName = 'index' ]) : array<string|int, string>
Parameters
$templateName : string = 'index'

The name of the template.

Return values
array<string|int, string>

Templates of modules.

HandleEvent()

Adds an event handler.

public HandleEvent(array<string|int, mixed>|string $ename, mixed $listener) : self
Parameters
$ename : array<string|int, mixed>|string

The event name or an array of event names.

$listener : mixed

The event handler.

Return values
self

Initialize()

Initializes the module manager.

public Initialize() : void

InitModule()

Initializes a module.

public InitModule(Config $configNode) : Module|null
Parameters
$configNode : Config

Configuration node for the module.

Return values
Module|null

The initialized module instance, or null if initialization fails.

RemoveHandler()

Removes an event handler.

public RemoveHandler(string $ename, mixed $listener) : self
Parameters
$ename : string

The event name.

$listener : mixed

The event handler to remove.

Return values
self

        
On this page

Search results