/** * Factory for connection class. * * @param Options $options Options object * @return static */ public static function factory(Options $options) { $socket = new SocketClient($options->getAddress()); $object = new static($socket); $object->setOptions($options); return $object; }
/** * Setup implementation. * * @return void */ protected function setupImplementation() { $this->connection->setEventManager($this->eventManager); $this->connection->setOptions($this->options); $implementation = $this->options->getImplementation(); $implementation->setEventManager($this->eventManager); $implementation->setOptions($this->options); $implementation->register(); $implementation->registerListener(new Logger()); }
public function register() { $this->app->bind('xmppbot', function () { $options = new Options(config('xmppbot.host')); $options->setTo(config('xmppbot.send-alias')); $options->setUsername(config('xmppbot.username'))->setPassword(config('xmppbot.password')); $client = new Client($options); return new XmppBot($client); }); }