/**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     $this->app->singleton('bugsnag', function ($app) {
         $config = $app['config']['bugsnag'];
         $bugsnagConfig = new Configuration($config['api_key']);
         $client = new Client($bugsnagConfig);
         $client->setStripPath(base_path());
         $client->setProjectRoot(base_path('app'));
         $client->setBatchSending(false);
         $client->setReleaseStage($app->environment());
         $client->setNotifier(array('name' => 'Bugsnag Laravel', 'version' => '1.4.2', 'url' => 'https://github.com/bugsnag/bugsnag-laravel'));
         if (isset($config['notify_release_stages']) && is_array($config['notify_release_stages'])) {
             $client->setNotifyReleaseStages($config['notify_release_stages']);
         }
         if (isset($config['endpoint'])) {
             $client->setEndpoint($config['endpoint']);
         }
         if (isset($config['filters']) && is_array($config['filters'])) {
             $client->setFilters($config['filters']);
         }
         if (isset($config['proxy']) && is_array($config['proxy'])) {
             $client->setProxySettings($config['proxy']);
         }
         // Check if someone is logged in.
         try {
             if ($app['auth']->check()) {
                 // User is logged in.
                 $user = $app['auth']->user();
                 // If these attributes are available: pass them on.
                 $client->setUser(array('id' => $user->getAuthIdentifier()));
             }
         } catch (\Exception $e) {
             // Do nothing.
         }
         return $client;
     });
 }
 /**
  * Setup the client paths.
  *
  * @param \Bugsnag\Client $client
  * @param string|null     $strip
  * @param string|null     $project
  *
  * @return void
  */
 protected function setupPaths(Client $client, $strip, $project)
 {
     if ($strip) {
         $client->setStripPath($strip);
         if (!$project) {
             $client->setProjectRoot("{$strip}/src");
         }
         return;
     }
     $base = realpath(__DIR__ . '/../../../../');
     if ($project) {
         if ($base && substr($project, 0, strlen($base)) === $base) {
             $client->setStripPath($base);
         }
         $client->setProjectRoot($project);
         return;
     }
     if ($base) {
         $client->setStripPath($base);
         if ($root = realpath("{$base}/src")) {
             $client->setProjectRoot($root);
         }
     }
 }
 /**
  * Setup the client paths.
  *
  * @param \Bugsnag\Client $client
  * @param string          $base
  * @param string          $path
  * @param string|null     $strip
  * @param string|null     $project
  *
  * @return void
  */
 protected function setupPaths(Client $client, $base, $path, $strip, $project)
 {
     if ($strip) {
         $client->setStripPath($strip);
         if (!$project) {
             $client->setProjectRoot("{$strip}/app");
         }
         return;
     }
     if ($project) {
         if ($base && substr($project, 0, strlen($base)) === $base) {
             $client->setStripPath($base);
         }
         $client->setProjectRoot($project);
         return;
     }
     $client->setStripPath($base);
     $client->setProjectRoot($path);
 }