Skip to content

Commit

Permalink
Merge pull request #110 from bugsnag/analysis-XW69aG
Browse files Browse the repository at this point in the history
Applied fixes from StyleCI
  • Loading branch information
GrahamCampbell authored Jun 20, 2016
2 parents 65f34bc + c5a124a commit f99cb8a
Show file tree
Hide file tree
Showing 6 changed files with 161 additions and 153 deletions.
12 changes: 8 additions & 4 deletions src/Bugsnag/BugsnagLaravel/BugsnagExceptionHandler.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
<?php namespace Bugsnag\BugsnagLaravel;
<?php

namespace Bugsnag\BugsnagLaravel;

use Exception;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;

class BugsnagExceptionHandler extends ExceptionHandler {
class BugsnagExceptionHandler extends ExceptionHandler
{
/**
* Report or log an exception.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Exception $e
* @param \Exception $e
*
* @return void
*/
public function report(Exception $e)
{
if ($this->shouldReport($e) && app()->bound('bugsnag')) {
app('bugsnag')->notifyException($e, null, "error");
app('bugsnag')->notifyException($e, null, 'error');
}

return parent::report($e);
Expand Down
4 changes: 3 additions & 1 deletion src/Bugsnag/BugsnagLaravel/BugsnagFacade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php namespace Bugsnag\BugsnagLaravel;
<?php

namespace Bugsnag\BugsnagLaravel;

use Illuminate\Support\Facades\Facade;

Expand Down
18 changes: 9 additions & 9 deletions src/Bugsnag/BugsnagLaravel/BugsnagLaravelServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php namespace Bugsnag\BugsnagLaravel;
<?php

namespace Bugsnag\BugsnagLaravel;

use Illuminate\Support\ServiceProvider;

Expand All @@ -18,28 +20,26 @@ class BugsnagLaravelServiceProvider extends ServiceProvider
*/
public function boot()
{

$app = $this->app;

if (version_compare($app::VERSION, '5.0') < 0) {

$this->package('bugsnag/bugsnag-laravel', 'bugsnag');

// Register for exception handling
$app->error(function (\Exception $exception) use ($app) {
if ('Symfony\Component\Debug\Exception\FatalErrorException'
!== get_class($exception)
) {
$app['bugsnag']->notifyException($exception, null, "error");
$app['bugsnag']->notifyException($exception, null, 'error');
}
});

// Register for fatal error handling
$app->fatal(function ($exception) use ($app) {
$app['bugsnag']->notifyException($exception, null, "error");
$app['bugsnag']->notifyException($exception, null, 'error');
});
} else {
$this->publishes(array(
$this->publishes(array(
__DIR__.'/config.php' => config_path('bugsnag.php'),
), 'config');
}
Expand All @@ -65,9 +65,9 @@ public function register()
$client->setBatchSending(false);
$client->setReleaseStage($app->environment());
$client->setNotifier(array(
'name' => 'Bugsnag Laravel',
'name' => 'Bugsnag Laravel',
'version' => '1.6.4',
'url' => 'https://github.com/bugsnag/bugsnag-laravel'
'url' => 'https://github.com/bugsnag/bugsnag-laravel',
));

if (isset($config['notify_release_stages']) && is_array($config['notify_release_stages'])) {
Expand Down Expand Up @@ -110,6 +110,6 @@ public function register()
*/
public function provides()
{
return array("bugsnag");
return array('bugsnag');
}
}
12 changes: 7 additions & 5 deletions src/Bugsnag/BugsnagLaravel/BugsnagLumenServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php namespace Bugsnag\BugsnagLaravel;
<?php

namespace Bugsnag\BugsnagLaravel;

use Illuminate\Support\ServiceProvider;

Expand Down Expand Up @@ -36,14 +38,14 @@ public function register()

$client = new \Bugsnag_Client($config['api_key']);
$client->setStripPath(base_path());
$client->setProjectRoot(base_path() . '/app');
$client->setProjectRoot(base_path().'/app');
$client->setAutoNotify(false);
$client->setBatchSending(false);
$client->setReleaseStage($app->environment());
$client->setNotifier(array(
'name' => 'Bugsnag Lumen',
'name' => 'Bugsnag Lumen',
'version' => '1.6.4',
'url' => 'https://github.com/bugsnag/bugsnag-laravel'
'url' => 'https://github.com/bugsnag/bugsnag-laravel',
));

if (isset($config['notify_release_stages']) && is_array($config['notify_release_stages'])) {
Expand Down Expand Up @@ -86,6 +88,6 @@ public function register()
*/
public function provides()
{
return array("bugsnag");
return array('bugsnag');
}
}
134 changes: 67 additions & 67 deletions src/Bugsnag/BugsnagLaravel/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,76 +2,76 @@

return array(

/*
|--------------------------------------------------------------------------
| API Key
|--------------------------------------------------------------------------
|
| You can find your API key on your Bugsnag dashboard.
|
| This api key points the Bugsnag notifier to the project in your account
| which should receive your application's uncaught exceptions.
|
*/
'api_key' => env('BUGSNAG_API_KEY'),
/*
|--------------------------------------------------------------------------
| API Key
|--------------------------------------------------------------------------
|
| You can find your API key on your Bugsnag dashboard.
|
| This api key points the Bugsnag notifier to the project in your account
| which should receive your application's uncaught exceptions.
|
*/
'api_key' => env('BUGSNAG_API_KEY'),

/*
|--------------------------------------------------------------------------
| Notify Release Stages
|--------------------------------------------------------------------------
|
| Set which release stages should send notifications to Bugsnag.
|
| Example: array('development', 'production')
|
*/
'notify_release_stages' => env('BUGSNAG_NOTIFY_RELEASE_STAGES', null),
/*
|--------------------------------------------------------------------------
| Notify Release Stages
|--------------------------------------------------------------------------
|
| Set which release stages should send notifications to Bugsnag.
|
| Example: array('development', 'production')
|
*/
'notify_release_stages' => env('BUGSNAG_NOTIFY_RELEASE_STAGES', null),

/*
|--------------------------------------------------------------------------
| Endpoint
|--------------------------------------------------------------------------
|
| Set what server the Bugsnag notifier should send errors to. By default
| this is set to 'https://notify.bugsnag.com', but for Bugsnag Enterprise
| this should be the URL to your Bugsnag instance.
|
*/
'endpoint' => env('BUGSNAG_ENDPOINT', null),
/*
|--------------------------------------------------------------------------
| Endpoint
|--------------------------------------------------------------------------
|
| Set what server the Bugsnag notifier should send errors to. By default
| this is set to 'https://notify.bugsnag.com', but for Bugsnag Enterprise
| this should be the URL to your Bugsnag instance.
|
*/
'endpoint' => env('BUGSNAG_ENDPOINT', null),

/*
|--------------------------------------------------------------------------
| Filters
|--------------------------------------------------------------------------
|
| Use this if you want to ensure you don't send sensitive data such as
| passwords, and credit card numbers to our servers. Any keys which
| contain these strings will be filtered.
|
*/
'filters' => env('BUGSNAG_FILTERS', array('password')),
/*
|--------------------------------------------------------------------------
| Filters
|--------------------------------------------------------------------------
|
| Use this if you want to ensure you don't send sensitive data such as
| passwords, and credit card numbers to our servers. Any keys which
| contain these strings will be filtered.
|
*/
'filters' => env('BUGSNAG_FILTERS', array('password')),

/*
|--------------------------------------------------------------------------
| Proxy
|--------------------------------------------------------------------------
|
| If your server is behind a proxy server, you can configure this as well.
| Other than the host, none of these settings are mandatory.
|
| Note: Proxy configuration is only possible if the PHP cURL extension
| is installed.
|
| Example:
|
| 'proxy' => array(
| 'host' => 'bugsnag.com',
| 'port' => 42,
| 'user' => 'username',
| 'password' => 'password123'
| )
|
*/
'proxy' => env('BUGSNAG_PROXY', null)
/*
|--------------------------------------------------------------------------
| Proxy
|--------------------------------------------------------------------------
|
| If your server is behind a proxy server, you can configure this as well.
| Other than the host, none of these settings are mandatory.
|
| Note: Proxy configuration is only possible if the PHP cURL extension
| is installed.
|
| Example:
|
| 'proxy' => array(
| 'host' => 'bugsnag.com',
| 'port' => 42,
| 'user' => 'username',
| 'password' => 'password123'
| )
|
*/
'proxy' => env('BUGSNAG_PROXY', null),

);
Loading

0 comments on commit f99cb8a

Please sign in to comment.