/**
  * Creates API client.
  *
  * @param BrowserConfiguration $browser Browser configuration.
  *
  * @return IAPIClient
  * @throws \LogicException When unsupported browser configuration given.
  */
 public function createAPIClient(BrowserConfiguration $browser)
 {
     if ($browser instanceof SauceLabsBrowserConfiguration) {
         $sauce_rest = new SauceRest($browser->getApiUsername(), $browser->getApiKey());
         return new SauceLabsAPIClient($sauce_rest);
     } elseif ($browser instanceof BrowserStackBrowserConfiguration) {
         return new BrowserStackAPIClient($browser->getApiUsername(), $browser->getApiKey(), ServiceFactory::getInstance()->getService('service.curl'));
     }
     throw new \LogicException('Unsupported browser configuration given');
 }