Erebot  latest
A modular IRC bot for PHP 5.3+
Erebot\Interfaces\ModuleContainer Interface Reference

An interface for an object capable of managing modules. More...

+ Inheritance diagram for Erebot\Interfaces\ModuleContainer:

Public Member Functions

 getModule ($name, $chan=null, $autoload=true)
 
 getModules ($chan=null)
 
 loadModule ($module, $chan=null)
 

Detailed Description

An interface for an object capable of managing modules.

Definition at line 28 of file ModuleContainer.php.

Member Function Documentation

Erebot\Interfaces\ModuleContainer::getModule (   $name,
  $chan = null,
  $autoload = true 
)

Returns an instance of a given module on a given channel.

Parameters
string$nameThe name of the module (ie. the name of the class implementing the feature we're interested in).
string$chan(optional) An IRC channel name. If given, the bot will try to return an instance which is specific to that particular channel, before falling back to a shared instance. Otherwise, this method only looks for a shared instance.
bool$autoload(optional) Whether the module should be autoloaded if it could not be found first time around (true) or not (false). The default is to autoload missing modules.
Return values
Erebot::Module::BaseAn instance of the given module.
Exceptions
Erebot::InvalidValueExceptionThrown when an invalid $type is passed.
Erebot::NotFoundExceptionThrown if no instance of the given module could be found.

Implemented in Erebot\IrcConnection.

Erebot\Interfaces\ModuleContainer::getModules (   $chan = null)

Returns the modules loaded for a given channel or for the whole connection.

Parameters
string$chan(optional) An IRC channel name. If given, both the modules which were specifically loaded for that channel and the shared modules are returned. Otherwise, only the shared modules are returned.
Return values
arrayA list of module instances implementing Erebot::Module::Base.

Implemented in Erebot\IrcConnection.

Erebot\Interfaces\ModuleContainer::loadModule (   $module,
  $chan = null 
)

Loads a module for a specific channel or for the whole connection.

Parameters
string$moduleThe name of the module to load.
NULL | string$chan(optional) An IRC channel name. If given, the module will be loaded and a specific instance will be created for that $chan. Otherwise, an instance will be created that will be shared across channels on the same connection.
Return values
Erebot::Module::BaseAn instance of the module.
Note
Only one instance of a module is ever created for a channel or the pool of shared modules. Therefore, it is safe to call this method multiple times with the same parameters.
Exceptions
Erebot::InvalidValueExceptionThrown when invalid values are found in the (meta)data of the module.
Erebot::NotFoundExceptionThrown when a required dependency could not be loaded. You may want to load the required dependency and then try to load the module again.

Implemented in Erebot\IrcConnection.


The documentation for this interface was generated from the following file: