Documentation

Module
in package
Uses TEventDispatcher

Module

Represents a base class for modules in the application.

Table of Contents

Properties

$instance  : self
$moduleConfigPath  : string
$moduleNamespace  : string
$modulePath  : string
$moduleStoragesPath  : string
$_config  : Config
Config object.
$_moduleConfigFile  : string
File path of the module configuration.
$_moduleNamespace  : string
Namespace of the module.
$_modulePath  : string
Location of the module.
$_moduleStoragesConfigPath  : string
File path of the module's storage configurations.

Methods

__get()  : mixed
Magic method to retrieve module properties.
Config()  : Config|ConfigItemsList
Returns the configuration object.
Create()  : self
Static constructor to create an instance of the Module class.
DispatchEvent()  : object|null
Dispatches an event.
Dispose()  : void
Disposes of the module object.
GetPathsFromModuleConfig()  : array<string|int, mixed>
Retrieves paths from the module configuration.
GetPermissions()  : array<string|int, mixed>
Retrieves the list of permissions for the module.
HandleEvent()  : self
Adds an event handler.
InitializeModule()  : void
Initializes the module after object creation.
Install()  : void
Installs the module.
RemoveHandler()  : self
Removes an event handler.
Uninstall()  : void
Uninstalls the module.
__construct()  : void
Constructor.

Properties

$instance

public self $instance

An instance of the Module class.

$moduleConfigPath read-only

public string $moduleConfigPath

The file path of the module's configuration.

$moduleNamespace read-only

public string $moduleNamespace

The namespace of the module.

$modulePath read-only

public string $modulePath

The path of the module.

$moduleStoragesPath read-only

public string $moduleStoragesPath

The file path of the module's storage configurations.

$_moduleConfigFile

File path of the module configuration.

protected string $_moduleConfigFile = ''

$_moduleNamespace

Namespace of the module.

protected string $_moduleNamespace

$_modulePath

Location of the module.

protected string $_modulePath

$_moduleStoragesConfigPath

File path of the module's storage configurations.

protected string $_moduleStoragesConfigPath = ''

Methods

__get()

Magic method to retrieve module properties.

public __get(string $prop) : mixed

Provides read-only access to module properties.

Parameters
$prop : string

The property name.

Return values
mixed

The value of the accessed property.

Config()

Returns the configuration object.

public Config([string|null $item = null ][, mixed $default = null ]) : Config|ConfigItemsList
Parameters
$item : string|null = null

The item to retrieve from the configuration.

$default : mixed = null

The default value if the item is not found.

Return values
Config|ConfigItemsList

Create()

Static constructor to create an instance of the Module class.

public static Create(mixed $config) : self
Parameters
$config : mixed

The configuration for the module.

Return values
self

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.

Dispose()

Disposes of the module object.

public Dispose() : void

GetPathsFromModuleConfig()

Retrieves paths from the module configuration.

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

Additional array to extend the result.

Return values
array<string|int, mixed>

GetPermissions()

Retrieves the list of permissions for the module.

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

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

InitializeModule()

Initializes the module after object creation.

public InitializeModule() : void

Install()

Installs the module.

public Install() : void

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

Uninstall()

Uninstalls the module.

public Uninstall() : void

__construct()

Constructor.

protected __construct(mixed $config) : void

Initializes a new instance of the Module class.

Parameters
$config : mixed

The configuration for the module.


        
On this page

Search results