Documentation

ModuleManager
in package

Handles the adding and removing of modules to the game.

Table of Contents

$g  : mixed
__construct()  : mixed
Construct a module manager.
getModule()  : Module|null
Returns the module with the specified library name, in vendor/module format.
getModules()  : array<string|int, Module>
Returns the list of currently registered modules.
register()  : mixed
Called when a module is added to the system. Performs setup tasks like registering the events this module responds to.
unregister()  : mixed
Called when a module is removed from the system. Performs teardown tasks like unregistering the events this module responds to.
validate()  : array<string|int, mixed>
Validate that all modules are installed correctly. Currently checks for all the proper event subscriptions.

Properties

Methods

__construct()

Construct a module manager.

public __construct(Game $g) : mixed
Parameters
$g : Game

The game.

Return values
mixed

getModule()

Returns the module with the specified library name, in vendor/module format.

public getModule(string $library) : Module|null
Parameters
$library : string
Return values
Module|null

getModules()

Returns the list of currently registered modules.

public getModules() : array<string|int, Module>
Return values
array<string|int, Module>

Array of modules.

register()

Called when a module is added to the system. Performs setup tasks like registering the events this module responds to.

public register(LibraryConfiguration $library) : mixed
Parameters
$library : LibraryConfiguration

LibraryConfiguration representing this module.

Tags
throws
ModuleAlreadyExistsException

if the module is already installed.

throws
ClassNotFoundException

if an event subscription class cannot be resolved.

throws
WrongTypeException

if an event subscription class does not implement the Module interface or the pattern is not a valid regular expression.

Return values
mixed

validate()

Validate that all modules are installed correctly. Currently checks for all the proper event subscriptions.

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

of strings describing issues. An empty array is returned on successful validation.

Search results