/**
* Creates a new Client instance and helps with constructing the right Browser object for the given remote URL
*
* @param null|string $url (optional) URL to your (local) Docker daemon, defaults to using local unix domain socket path
* @return Client
*/
public function createClient($url = null)
{
if ($url === null) {
$url = 'unix:///var/run/docker.sock';
}
$browser = $this->browser;
if (substr($url, 0, 7) === 'unix://') {
// send everything through a local unix domain socket
$browser = $this->browser->withSender(Sender::createFromLoopUnix($this->loop, $url));
// pretend all HTTP URLs to be on localhost
$url = 'http://localhost/';
}
return new Client($browser->withBase($url));
}