connectionManager = $connectionManager; $this->delay = $delay; $this->loop = $loop; } public function connect($uri) { $connectionManager = $this->connectionManager; return Timer\resolve($this->delay, $this->loop)->then(function () use ($connectionManager, $uri) { return $connectionManager->connect($uri); }); } }