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

Interface for the main (general) configuration. More...

+ Inheritance diagram for Erebot\Interfaces\Config\Main:

Public Member Functions

 __clone ()
 
 getCommandsPrefix ()
 
 getConfigFile ()
 
 getGroupIdentity ()
 
 getNetworkCfg ($network)
 
 getNetworks ()
 
 getPidfile ()
 
 getTimezone ()
 
 getUserIdentity ()
 
 getVersion ()
 
 load ($configData, $source)
 
 mustDaemonize ()
 
- Public Member Functions inherited from Erebot\Interfaces\Config\Proxy
 getMainCfg ()
 
 getModule ($moduleName)
 
 getModules ($recursive)
 
 getTranslator ($component)
 
 parseBool ($module, $param, $default=null)
 
 parseInt ($module, $param, $default=null)
 
 parseReal ($module, $param, $default=null)
 
 parseString ($module, $param, $default=null)
 

Public Attributes

const LOAD_FROM_FILE = 1
 Indicates that the configuration must be loaded from a file.
 
const LOAD_FROM_STRING = 2
 Indicates that the configuration must be loaded from a string.
 

Detailed Description

Interface for the main (general) configuration.

This interface provides the necessary methods to represent the general configuration associated with an instance of the bot.

Definition at line 31 of file Main.php.

Member Function Documentation

Erebot\Interfaces\Config\Main::__clone ( )

Prevents cloning of this class to avoid escape from the singleton design pattern.

Implemented in Erebot\Config\Main.

Erebot\Interfaces\Config\Main::getCommandsPrefix ( )

Returns the prefix used by commands.

Return values
stringThe prefix for commands, such as '!'.

Implemented in Erebot\Config\Main.

Erebot\Interfaces\Config\Main::getConfigFile ( )

Returns the name of the currently loaded configuration file.

Return values
stringCurrently loaded configuration file.
nullNo configuration file has been loaded or the configuration was loaded using Erebot::Interfaces::Config::Main::LOAD_FROM_STRING.

Implemented in Erebot\Config\Main.

Erebot\Interfaces\Config\Main::getGroupIdentity ( )

Returns the group identity the bot should switch to upon startup.

Return values
stringThe group name or GID the bot must switch to, or null if the bot should keep its current group identity.
Note
To be able to impersonate some group's identity, the bot must be launched by the super-user (root).
The -g (–group) command-line switch can be used to override this option.

Implemented in Erebot\Config\Main.

Erebot\Interfaces\Config\Main::getNetworkCfg (   $network)

Returns the configuration object for a particular IRC network.

Parameters
string$networkThe name of the IRC network whose configuration we're interested in.
Return values
Erebot::Interfaces::Config::NetworkThe configuration object for that network.
Exceptions
Erebot::NotFoundExceptionNo such network has been configured on the bot.

Implemented in Erebot\Config\Main.

Erebot\Interfaces\Config\Main::getNetworks ( )

Returns all IRC network configurations.

Return values
arrayA list of network configurations, as objects implementing Erebot::Interfaces::Config::Network.

Implemented in Erebot\Config\Main.

Erebot\Interfaces\Config\Main::getPidfile ( )

Returns the file where the bot's PID should be written to upon startup.

Return values
stringThe file where the bot's PID should be written, or null if its PID should not be written anywhere.
Note
The -p (–pidfile) command-line switch can be used to override this option.

Implemented in Erebot\Config\Main.

Erebot\Interfaces\Config\Main::getTimezone ( )

Returns the bot's timezone.

Return values
stringThe bot's current timezone, such as 'Europe/Paris'.

Implemented in Erebot\Config\Main.

Erebot\Interfaces\Config\Main::getUserIdentity ( )

Returns the user identity the bot should switch to upon startup.

Return values
stringThe user name or GID the bot must switch to, or null if the bot should keep its current user identity.
Note
To be able to impersonate some user's identity, the bot must be launched by the super-user (root).
The -u (–user) command-line switch can be used to override this option.

Implemented in Erebot\Config\Main.

Erebot\Interfaces\Config\Main::getVersion ( )

Returns the configuration file's version string.

Return values
stringThe bot's version, such as '0.20-pre'.
Note
This version string is compatible with PHP's versioning scheme. Therefore, you may use PHP's version_compare() function to compare the version strings for different releases of the bot.
This is the version string as it was indicated in the configuration file (at the time it was written). This may be different from the actual version of the code.

Implemented in Erebot\Config\Main.

Erebot\Interfaces\Config\Main::load (   $configData,
  $source 
)

(Re)loads a configuration file.

Parameters
string$configDataEither a (relative or absolute) path to the configuration file to load or a string representation of the configuration, depending on the value of the $source parameter.
opaque$sourceErebot::Interfaces::Config::Main::LOAD_FROM_FILE or Erebot::Interfaces::Config::Main::LOAD_FROM_STRING, depending on whether $configData contains a filename or the string representation of the configuration data, respectively.
Exceptions
Erebot::InvalidValueExceptionThe configuration file did not exist or contained invalid values. This exception is also thrown when the $source parameter contains an invalid value.
Note
Each time this method is called, all previous settings will be discarded.

Implemented in Erebot\Config\Main.

Erebot\Interfaces\Config\Main::mustDaemonize ( )

Indicates whether the bot should "daemonize" itself upon startup.

Return values
booltrue if the bot must turn into a daemon, false otherwise.
Note
The -n (–no-daemon) and -d (–daemon) command-line flags can be used to override this option.

Implemented in Erebot\Config\Main.


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