/**
* 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();
}