/** * Configures the IRC Client */ private function configure() { $this->connection->setServerHostname($this->getContainer()->get('config')['irc']['server']['host'])->setServerPort($this->getContainer()->get('config')['irc']['server']['port'])->setNickname($this->getContainer()->get('config')['irc']['nickname'])->setUsername($this->getContainer()->get('config')['irc']['username'])->setRealname($this->getContainer()->get('config')['irc']['realname']); if ($this->getContainer()->get('config')['irc']['server']['ssl']) { $this->connection->setOption('transport', 'ssl'); } $this->client->setLogger($this->getContainer()->get('logger')); $this->client->setDnsServer($this->getContainer()->get('config')['dns_server']); }
/** * Loads all modules. * * @param string $configFile The configuration file to use for this bot instance. */ public function __construct($configFile = WPHP_CONFIG) { $configurationStorage = new ConfigurationStorage($configFile); $this->getApi()->setConfigurationStorage($configurationStorage); $this->getApi()->getModuleEmitter(); // Connect using the given data. $connection = new Connection(); $connection->setServerHostname($configurationStorage->get('server'))->setServerPort($configurationStorage->get('port'))->setNickname($configurationStorage->get('nick'))->setUsername($configurationStorage->get('name'))->setRealname('A WildPHP Bot'); $this->connect($connection); }
public function testFluentInterface() { $this->assertSame($this->connection, $this->connection->setServerHostname('hostname')); $this->assertSame($this->connection, $this->connection->setServerPort(6668)); $this->assertSame($this->connection, $this->connection->setPassword('password')); $this->assertSame($this->connection, $this->connection->setNickname('nickname')); $this->assertSame($this->connection, $this->connection->setUsername('username')); $this->assertSame($this->connection, $this->connection->setHostname('hostname')); $this->assertSame($this->connection, $this->connection->setServername('servername')); $this->assertSame($this->connection, $this->connection->setRealname('realname')); $this->assertSame($this->connection, $this->connection->setOption('foo', 'bar')); $this->assertSame($this->connection, $this->connection->setData('foo', 'bar')); }