/**
  * Make a new bugsnag client instance.
  *
  * @param \Silex\Application $app
  *
  * @return \Bugsnag\Client
  */
 protected function makeClient(Application $app)
 {
     try {
         $config = $app['bugsnag.options'];
     } catch (InvalidArgumentException $e) {
         $config = [];
     }
     $key = isset($config['api_key']) ? $config['api_key'] : getenv('BUGSNAG_API_KEY');
     $guzzle = Client::makeGuzzle(isset($config['endpoint']) ? $config['endpoint'] : null);
     $client = new Client(new Configuration($key), $app['bugsnag.resolver'], $guzzle);
     if (!isset($config['callbacks']) || $config['callbacks']) {
         $client->registerDefaultCallbacks();
     }
     if (!isset($config['user']) || $config['user']) {
         $this->setupUserDetection($client, $app);
     }
     $this->setupPaths($client, isset($config['strip_path']) ? $config['strip_path'] : null, isset($config['project_root']) ? $config['project_root'] : null);
     $stage = getenv('SYMFONY_ENV') ?: null;
     $client->setReleaseStage($stage === 'prod' ? 'production' : $stage);
     $client->setHostname(isset($config['hostname']) ? $config['hostname'] : null);
     $client->setFallbackType('Console');
     $client->setAppType(isset($config['app_type']) ? $config['app_type'] : null);
     $client->setAppVersion(isset($config['app_version']) ? $config['app_version'] : null);
     $client->setBatchSending(isset($config['batch_sending']) ? $config['batch_sending'] : true);
     $client->setSendCode(isset($config['send_code']) ? $config['send_code'] : true);
     $client->setNotifier(['name' => 'Bugsnag Silex', 'version' => static::VERSION, 'url' => 'https://github.com/bugsnag/bugsnag-silex']);
     if (isset($config['notify_release_stages']) && is_array($config['notify_release_stages'])) {
         $client->setNotifyReleaseStages($config['notify_release_stages']);
     }
     if (isset($config['filters']) && is_array($config['filters'])) {
         $client->setFilters($config['filters']);
     }
     return $client;
 }
 /**
  * Get the guzzle client instance.
  *
  * @param array $config
  *
  * @return \GuzzleHttp\ClientInterface
  */
 protected function getGuzzle(array $config)
 {
     $options = [];
     if (isset($config['proxy']) && $config['proxy']) {
         if (isset($config['proxy']['http']) && php_sapi_name() != 'cli') {
             unset($config['proxy']['http']);
         }
         $options['proxy'] = $config['proxy'];
     }
     return Client::makeGuzzle(isset($config['endpoint']) ? $config['endpoint'] : null, $options);
 }