Skip to content

Commit

Permalink
New styleci config
Browse files Browse the repository at this point in the history
  • Loading branch information
jenssegers committed May 9, 2015
1 parent fb90b12 commit 21fb075
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 50 deletions.
7 changes: 6 additions & 1 deletion .styleci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
preset: psr2
preset: recommended

disabled:
- braces
- no_blank_lines_after_class_opening
- phpdoc_separation
- ordered_use
- phpdoc_order
- short_array_syntax
44 changes: 22 additions & 22 deletions src/RavenLogHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,29 @@
class RavenLogHandler {

/**
* The raven client instance.
*
* @var Raven_Client
*/
* The raven client instance.
*
* @var Raven_Client
*/
protected $raven;

/**
* The Laravel application.
*
* @var \Illuminate\Foundation\Application
*/
* The Laravel application.
*
* @var \Illuminate\Foundation\Application
*/
protected $app;

/**
* The minimum log level at which messages are sent to Sentry.
*
* @var string
*/
* The minimum log level at which messages are sent to Sentry.
*
* @var string
*/
protected $level;

/**
* Constructor.
*/
* Constructor.
*/
public function __construct(Raven_Client $raven, Application $app, $level = 'debug')
{
$this->raven = $raven;
Expand All @@ -41,12 +41,12 @@ public function __construct(Raven_Client $raven, Application $app, $level = 'deb
}

/**
* Log a message to Sentry.
*
* @param mixed $level
* @param string $message
* @param array $context
*/
* Log a message to Sentry.
*
* @param mixed $level
* @param string $message
* @param array $context
*/
public function log($level, $message, array $context = [])
{
// Check if we want to log this message.
Expand Down Expand Up @@ -103,7 +103,7 @@ protected function addContext(array $context = [])
// Automatic tags
$tags = [
'environment' => $this->app->environment(),
'server' => $this->app->request->server('HTTP_HOST')
'server' => $this->app->request->server('HTTP_HOST'),
];

// Add tags to context.
Expand Down Expand Up @@ -144,7 +144,7 @@ protected function addContext(array $context = [])
/**
* Parse the string level into a Monolog constant.
*
* @param string $level
* @param string $level
* @return int
*
* @throws \InvalidArgumentException
Expand Down
1 change: 0 additions & 1 deletion src/RavenServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php namespace Jenssegers\Raven;

use Exception;
use InvalidArgumentException;
use Raven_Client;
use Raven_ErrorHandler;
Expand Down
52 changes: 26 additions & 26 deletions tests/RavenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,17 @@ public function testAutomaticContext()
$clientMock = Mockery::mock('Raven_Client');
$clientMock->shouldReceive('captureMessage')->once()->with('Test log message', [], [
'level' => 'info',
'user' => [
'user' => [
'data' => ['foo' => 'bar'],
'id' => $this->app->session->getId()
'id' => $this->app->session->getId(),
],
'tags' => [
'environment' => 'testing',
'server' => 'localhost'
'server' => 'localhost',
],
'extra' => [
'ip' => '127.0.0.1'
]
'ip' => '127.0.0.1',
],
]);

$handlerMock = Mockery::mock('Jenssegers\Raven\RavenLogHandler', [$clientMock, $this->app]);
Expand All @@ -108,19 +108,19 @@ public function testMergedContext()
$clientMock = Mockery::mock('Raven_Client');
$clientMock->shouldReceive('captureMessage')->once()->with('Test log message', [], [
'level' => 'info',
'user' => [
'user' => [
'email' => 'john@doe.com',
'data' => ['foo' => 'bar'],
'id' => 1337
'data' => ['foo' => 'bar'],
'id' => 1337,
],
'tags' => [
'environment' => 'testing',
'server' => 'localhost',
'one' => 'two'
'server' => 'localhost',
'one' => 'two',
],
'extra' => [
'ip' => '127.0.0.1'
]
'ip' => '127.0.0.1',
],
]);

$handlerMock = Mockery::mock('Jenssegers\Raven\RavenLogHandler', [$clientMock, $this->app]);
Expand All @@ -130,7 +130,7 @@ public function testMergedContext()
$handler = $this->app->make('raven.handler');
$handler->log('info', 'Test log message', [
'tags' => ['one' => 'two'],
'user' => ['id' => 1337, 'email' => 'john@doe.com']
'user' => ['id' => 1337, 'email' => 'john@doe.com'],
]);
}

Expand All @@ -139,15 +139,15 @@ public function testEasyExtraData()
$clientMock = Mockery::mock('Raven_Client');
$clientMock->shouldReceive('captureMessage')->once()->with('Test log message', [], [
'level' => 'info',
'tags' => [
'tags' => [
'environment' => 'testing',
'server' => 'localhost',
'server' => 'localhost',
],
'extra' => [
'ip' => '192.168.0.1',
'ip' => '192.168.0.1',
'download_size' => 3432425235,
'foo' => 'bar'
]
'foo' => 'bar',
],
]);

$handlerMock = Mockery::mock('Jenssegers\Raven\RavenLogHandler', [$clientMock, $this->app]);
Expand All @@ -157,10 +157,10 @@ public function testEasyExtraData()
$handler = $this->app->make('raven.handler');
$handler->log('info', 'Test log message', [
'download_size' => 3432425235,
'ip' => '192.168.0.1',
'extra' => [
'foo' => 'bar'
]
'ip' => '192.168.0.1',
'extra' => [
'foo' => 'bar',
],
]);
}

Expand All @@ -172,13 +172,13 @@ public function testLogListener()
$clientMock->shouldReceive('captureMessage')->times(2);
$clientMock->shouldReceive('captureException')->times(1)->with($exception, [
'level' => 'error',
'tags' => [
'tags' => [
'environment' => 'testing',
'server' => 'localhost'
'server' => 'localhost',
],
'extra' => [
'ip' => '127.0.0.1'
]
'ip' => '127.0.0.1',
],
]);

$handlerMock = Mockery::mock('Jenssegers\Raven\RavenLogHandler', [$clientMock, $this->app]);
Expand Down

0 comments on commit 21fb075

Please sign in to comment.