aboutsummaryrefslogtreecommitdiffhomepage
path: root/main/app/sprinkles/account/src/Log
diff options
context:
space:
mode:
authorMarvin Borner2018-06-08 20:03:25 +0200
committerMarvin Borner2018-06-08 20:03:25 +0200
commit92b7dd3335a6572debeacfb5faa82c63a5e67888 (patch)
tree7ebbca22595d542ec5e2912a24a0400ac8f6b113 /main/app/sprinkles/account/src/Log
parent22a1bb27f94ea33042b0bdd35bef1a5cfa96cc0d (diff)
Some minor fixes
Diffstat (limited to 'main/app/sprinkles/account/src/Log')
-rw-r--r--main/app/sprinkles/account/src/Log/UserActivityDatabaseHandler.php66
-rw-r--r--main/app/sprinkles/account/src/Log/UserActivityProcessor.php88
2 files changed, 77 insertions, 77 deletions
diff --git a/main/app/sprinkles/account/src/Log/UserActivityDatabaseHandler.php b/main/app/sprinkles/account/src/Log/UserActivityDatabaseHandler.php
index a1cd14f..eb57f43 100644
--- a/main/app/sprinkles/account/src/Log/UserActivityDatabaseHandler.php
+++ b/main/app/sprinkles/account/src/Log/UserActivityDatabaseHandler.php
@@ -1,33 +1,33 @@
-<?php
-/**
- * UserFrosting (http://www.userfrosting.com)
- *
- * @link https://github.com/userfrosting/UserFrosting
- * @license https://github.com/userfrosting/UserFrosting/blob/master/licenses/UserFrosting.md (MIT License)
- */
-
-namespace UserFrosting\Sprinkle\Account\Log;
-
-use UserFrosting\Sprinkle\Core\Log\DatabaseHandler;
-
-/**
- * Monolog handler for storing user activities to the database.
- *
- * @author Alex Weissman (https://alexanderweissman.com)
- */
-class UserActivityDatabaseHandler extends DatabaseHandler
-{
- /**
- * {@inheritDoc}
- */
- protected function write(array $record) {
- $log = $this->classMapper->createInstance($this->modelName, $record['extra']);
- $log->save();
-
- if (isset($record['extra']['user_id'])) {
- $user = $this->classMapper->staticMethod('user', 'find', $record['extra']['user_id']);
- $user->last_activity_id = $log->id;
- $user->save();
- }
- }
-}
+<?php
+/**
+ * UserFrosting (http://www.userfrosting.com)
+ *
+ * @link https://github.com/userfrosting/UserFrosting
+ * @license https://github.com/userfrosting/UserFrosting/blob/master/licenses/UserFrosting.md (MIT License)
+ */
+
+namespace UserFrosting\Sprinkle\Account\Log;
+
+use UserFrosting\Sprinkle\Core\Log\DatabaseHandler;
+
+/**
+ * Monolog handler for storing user activities to the database.
+ *
+ * @author Alex Weissman (https://alexanderweissman.com)
+ */
+class UserActivityDatabaseHandler extends DatabaseHandler
+{
+ /**
+ * {@inheritDoc}
+ */
+ protected function write(array $record) {
+ $log = $this->classMapper->createInstance($this->modelName, $record['extra']);
+ $log->save();
+
+ if (isset($record['extra']['user_id'])) {
+ $user = $this->classMapper->staticMethod('user', 'find', $record['extra']['user_id']);
+ $user->last_activity_id = $log->id;
+ $user->save();
+ }
+ }
+}
diff --git a/main/app/sprinkles/account/src/Log/UserActivityProcessor.php b/main/app/sprinkles/account/src/Log/UserActivityProcessor.php
index f1aa8c7..a5c0d98 100644
--- a/main/app/sprinkles/account/src/Log/UserActivityProcessor.php
+++ b/main/app/sprinkles/account/src/Log/UserActivityProcessor.php
@@ -1,44 +1,44 @@
-<?php
-/**
- * UserFrosting (http://www.userfrosting.com)
- *
- * @link https://github.com/userfrosting/UserFrosting
- * @license https://github.com/userfrosting/UserFrosting/blob/master/licenses/UserFrosting.md (MIT License)
- */
-
-namespace UserFrosting\Sprinkle\Account\Log;
-
-use Monolog\Logger;
-
-/**
- * Monolog processor for constructing the user activity message.
- *
- * @author Alex Weissman (https://alexanderweissman.com)
- */
-class UserActivityProcessor
-{
- /**
- * @var int
- */
- protected $userId;
-
- /**
- * @param int $userId The id of the user for whom we will be logging activities.
- */
- public function __construct($userId) {
- $this->userId = $userId;
- }
-
- public function __invoke(array $record) {
- $additionalFields = [
- 'ip_address' => $_SERVER['REMOTE_ADDR'],
- 'user_id' => $this->userId,
- 'occurred_at' => $record['datetime'],
- 'description' => $record['message']
- ];
-
- $record['extra'] = array_replace_recursive($record['extra'], $additionalFields, $record['context']);
-
- return $record;
- }
-}
+<?php
+/**
+ * UserFrosting (http://www.userfrosting.com)
+ *
+ * @link https://github.com/userfrosting/UserFrosting
+ * @license https://github.com/userfrosting/UserFrosting/blob/master/licenses/UserFrosting.md (MIT License)
+ */
+
+namespace UserFrosting\Sprinkle\Account\Log;
+
+use Monolog\Logger;
+
+/**
+ * Monolog processor for constructing the user activity message.
+ *
+ * @author Alex Weissman (https://alexanderweissman.com)
+ */
+class UserActivityProcessor
+{
+ /**
+ * @var int
+ */
+ protected $userId;
+
+ /**
+ * @param int $userId The id of the user for whom we will be logging activities.
+ */
+ public function __construct($userId) {
+ $this->userId = $userId;
+ }
+
+ public function __invoke(array $record) {
+ $additionalFields = [
+ 'ip_address' => $_SERVER['REMOTE_ADDR'],
+ 'user_id' => $this->userId,
+ 'occurred_at' => $record['datetime'],
+ 'description' => $record['message']
+ ];
+
+ $record['extra'] = array_replace_recursive($record['extra'], $additionalFields, $record['context']);
+
+ return $record;
+ }
+}