Erebot  latest
A modular IRC bot for PHP 7.0+
Erebot\Core Class Reference

Provides core functionalities for Erebot. More...

+ Inheritance diagram for Erebot\Core:

Public Member Functions

 __clone ()
 __construct (\Erebot\Interfaces\Config\Main $config,\Erebot\Intl\TranslatorInterface $translator)
 __destruct ()
 addConnection (\Erebot\Interfaces\Connection $connection)
 addTimer (\Erebot\TimerInterface $timer)
 getConnections ()
 getRunningTime ()
 gettext ($message)
 getTimers ()
 handleSIGHUP ($signum)
 handleSignal ($signum)
 reload (\Erebot\Interfaces\Config\Main $config=null)
 removeConnection (\Erebot\Interfaces\Connection $connection)
 removeTimer (\Erebot\TimerInterface $timer)
 start (\Erebot\Interfaces\ConnectionFactory $factory)
 stop ()

Protected Member Functions

 createConnections (\Erebot\Interfaces\ConnectionFactory $factory,\Erebot\Interfaces\Config\Main $config)
 realStart (\Erebot\Interfaces\ConnectionFactory $factory)

Protected Attributes

 Connections to handle.
 Main configuration for the bot.
 Indicates whether the bot is currently running or not.
 Timers to trigger.
 Translator object for messages the bot may display.

Detailed Description

Provides core functionalities for Erebot.

This class is responsible for controlling the bot, from its start to its shutdown. This is the class that will create new connections, handle timers, apply multiplexing, etc.

The main method you will be interested in is Erebot::start() which starts the bot.

Definition at line 59 of file Core.php.

Constructor & Destructor Documentation

Erebot\Core::__construct ( \Erebot\Interfaces\Config\Main  $config,
\Erebot\Intl\TranslatorInterface  $translator 

Creates a new Erebot instance.

Erebot::Interfaces::Config::MainInterface$configThe (main) configuration to use.
Erebot::Intl::TranslatorInterface$translatorA translator object that will provide translations for messages emitted by the core class.

Definition at line 86 of file Core.php.

Erebot\Core::__destruct ( )

Destruct an Erebot instance.

Definition at line 120 of file Core.php.

Member Function Documentation

Erebot\Core::__clone ( )


Definition at line 128 of file Core.php.

Erebot\Core::createConnections ( \Erebot\Interfaces\ConnectionFactory  $factory,
\Erebot\Interfaces\Config\Main  $config 

Creates the connections for this instance.

Erebot::Interfaces::ConnectionFactory$factoryThe factory to use to create the connections.
Erebot::Interfaces::Config::Main$configThe main configuration for the bot.

Definition at line 547 of file Core.php.

Erebot\Core::getConnections ( )

Definition at line 134 of file Core.php.

Erebot\Core::handleSIGHUP (   $signum)

Handles requests to reload the configuration. Such requests are received as signals.

int$signumThe number of the signal.

Definition at line 489 of file Core.php.

Erebot\Core::handleSignal (   $signum)

Handles request for a graceful shutdown of the bot. Such requests are received as signals.

int$signumThe number of the signal.

Definition at line 361 of file Core.php.

Erebot\Core::realStart ( \Erebot\Interfaces\ConnectionFactory  $factory)

Really starts the bot.

Erebot::Interfaces::ConnectionFactory$factoryFactory to use to create new connections.
This method does not return until the bot drops its connections. Therefore, this MUST be the last method you call in your script.
This method is called by Erebot::start() and does the actual workload of running the bot.

Definition at line 153 of file Core.php.

Erebot\Core::reload ( \Erebot\Interfaces\Config\Main  $config = null)

Reload this instance of the bot.

This method makes the bot reload most of the data it currently relies on, such as configuration files.

Erebot::Interfaces::Config::MainInterface$config(optional) The new configuration to use. If omitted, the configuration file currently in use is reloaded.

Definition at line 505 of file Core.php.

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