Menu

## ModuleManager
in package

ModuleManager.php : 18

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

#### $g

ModuleManager.php : 20
`private mixed $g`

### Methods

#### __construct()

ModuleManager.php : 26

Construct a module manager.

`public __construct(Game $g) : mixed`

##### Parameters

$g : Game

  The game.

##### Return values

mixed —

#### getModule()

ModuleManager.php : 163

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()

ModuleManager.php : 153

Returns the list of currently registered modules.

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

##### Return values

array<string|int, Module> —

Array of modules.

#### register()

ModuleManager.php : 41

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 —

#### unregister()

ModuleManager.php : 116

Called when a module is removed from the system. Performs teardown tasks like unregistering the events this module responds to.

`public unregister(LibraryConfiguration $library) : mixed`

##### Parameters

$library : LibraryConfiguration

  LibraryConfiguration representing this module.

##### Tags

throws
  ModuleDoesNotExistException

  if the module is not installed.

##### Return values

mixed —

#### validate()

ModuleManager.php : 174

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