Skip to content

Commit

Permalink
psr2
Browse files Browse the repository at this point in the history
  • Loading branch information
freekmurze committed Jun 23, 2016
1 parent 14728cf commit e87ae35
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/CleanActivitylogCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class CleanActivitylogCommand extends Command
* @var string
*/
protected $signature = 'activitylog:clean';

/**
* The console command description.
*
Expand Down
2 changes: 1 addition & 1 deletion src/Exceptions/CouldNotLogActivity.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ public static function couldNotDetermineUser($id)
{
return new static("Could not determine a user with identifier `{$id}`.");
}
}
}
3 changes: 2 additions & 1 deletion src/Models/Activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ public function causer(): MorphTo
{
return $this->morphTo();
}

/**
* Get the extra properties with the given name.
*
* @param $propertyName
*
* @return mixed
*/
public function getExtraProperty(string $propertyName)
Expand Down
2 changes: 1 addition & 1 deletion src/Traits/LogsActivity.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ protected static function bootLogsActivity()
if ($description == '') {
return;
}

$extraProperties = [];
if ($eventName != 'deleted') {
$extraProperties['changes'] = $model->getChanges();
Expand Down
7 changes: 3 additions & 4 deletions src/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

use Spatie\Activitylog\ActivityLogger;

if (! function_exists('activity')) {

function activity(): ActivityLogger {
if (!function_exists('activity')) {
function activity(): ActivityLogger
{
return app(ActivityLogger::class);
}

}
2 changes: 1 addition & 1 deletion tests/ActivityloggerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ public function it_can_log_an_activity()

$this->assertEquals($activityDescription, Activity::first()->description);
}
}
}
2 changes: 1 addition & 1 deletion tests/Models/Article.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
class Article extends Model
{
protected $guarded = [];
}
}
2 changes: 1 addition & 1 deletion tests/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ class User extends Model
use CausesActivity;

protected $guarded = [];
}
}
10 changes: 4 additions & 6 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function setUp()
protected function getPackageProviders($app)
{
return [
ActivitylogServiceProvider::class
ActivitylogServiceProvider::class,
];
}

Expand All @@ -30,7 +30,7 @@ public function getEnvironmentSetUp($app)

$app['config']->set('database.connections.sqlite', [
'driver' => 'sqlite',
'database' => $this->getTempDirectory() . '/database.sqlite',
'database' => $this->getTempDirectory().'/database.sqlite',
'prefix' => '',
]);
$app['config']->set('app.key', '6rE9Nz59bGRbeMATftriyQjrpF7DcOQm');
Expand All @@ -48,7 +48,7 @@ protected function setUpDatabase()

protected function resetDatabase()
{
file_put_contents($this->getTempDirectory() . '/database.sqlite', null);
file_put_contents($this->getTempDirectory().'/database.sqlite', null);
}

protected function createActivityLogTable()
Expand All @@ -60,7 +60,7 @@ protected function createActivityLogTable()

public function getTempDirectory(): string
{
return __DIR__ . '/temp';
return __DIR__.'/temp';
}

protected function createTables(...$tableNames)
Expand All @@ -82,6 +82,4 @@ protected function seedModels(...$modelClasses)
}
});
}


}

0 comments on commit e87ae35

Please sign in to comment.