getConnection() public method

Get connection object.
public getConnection ( ) : Fabiang\Xmpp\Connection\ConnectionInterface
return Fabiang\Xmpp\Connection\ConnectionInterface
Ejemplo n.º 1
0
 /**
  * Constructor.
  *
  * @param Options               $options      Client options
  * @param EventManagerInterface $eventManager Event manager
  */
 public function __construct(Options $options, EventManagerInterface $eventManager = null)
 {
     // create default connection
     if (null !== $options->getConnection()) {
         $connection = $options->getConnection();
     } else {
         $connection = Socket::factory($options);
         $options->setConnection($connection);
     }
     $this->options = $options;
     $this->connection = $connection;
     if (null === $eventManager) {
         $eventManager = new EventManager();
     }
     $this->eventManager = $eventManager;
     $this->setupImplementation();
 }