Skip to content

Commit

Permalink
Apply fixes from StyleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
StyleCIBot committed Mar 28, 2024
1 parent e042620 commit 7423510
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions Model/SentryInteraction.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@

// phpcs:disable Magento2.Functions.DiscouragedFunction

use function Sentry\captureException;
use function Sentry\configureScope;
use function Sentry\init;
use Magento\Authorization\Model\UserContextInterface;
use Magento\Backend\Model\Auth\Session as AdminSession;
use Magento\Customer\Model\Session as CustomerSession;
Expand All @@ -17,12 +14,17 @@
use Magento\Framework\Exception\LocalizedException;
use Sentry\State\Scope;

use function Sentry\captureException;
use function Sentry\configureScope;
use function Sentry\init;

class SentryInteraction
{
public function __construct(
private UserContextInterface $userContext,
private State $appState
) { }
) {
}

public function initialize($config)
{
Expand All @@ -49,10 +51,10 @@ private function getSessionUserData()
if ($this->appState->getAreaCode() === Area::AREA_ADMINHTML) {
$adminSession = $objectManager->get(AdminSession::class);

if($adminSession->isLoggedIn()) {
if ($adminSession->isLoggedIn()) {
return [
'id' => $adminSession->getUser()->getId(),
'email' => $adminSession->getUser()->getEmail(),
'id' => $adminSession->getUser()->getId(),
'email' => $adminSession->getUser()->getEmail(),
'user_type' => UserContextInterface::USER_TYPE_ADMIN,
];
}
Expand All @@ -61,13 +63,13 @@ private function getSessionUserData()
if ($this->appState->getAreaCode() === Area::AREA_FRONTEND) {
$customerSession = $objectManager->get(CustomerSession::class);

if($customerSession->loggedIn()) {
if ($customerSession->loggedIn()) {
return [
'id' => $customerSession->getCustomer()->getId(),
'email' => $customerSession->getCustomer()->getEmail(),
'id' => $customerSession->getCustomer()->getId(),
'email' => $customerSession->getCustomer()->getEmail(),
'website_id' => $customerSession->getCustomer()->getWebsiteId(),
'store_id' => $customerSession->getCustomer()->getStoreId(),
'user_type' => UserContextInterface::USER_TYPE_CUSTOMER,
'user_type' => UserContextInterface::USER_TYPE_CUSTOMER,
];
}
}
Expand All @@ -80,6 +82,7 @@ public function addUserContext()
$userId = null;
$userType = null;
$userData = [];

try {
$userId = $this->userContext->getUserId();
if ($userId) {
Expand All @@ -100,7 +103,7 @@ public function addUserContext()
$scope->setUser([
'id' => $userId,
...$userData,
'user_type' => match($userType) {
'user_type' => match ($userType) {
UserContextInterface::USER_TYPE_INTEGRATION => 'integration',
UserContextInterface::USER_TYPE_ADMIN => 'admin',
UserContextInterface::USER_TYPE_CUSTOMER => 'customer',
Expand Down

0 comments on commit 7423510

Please sign in to comment.