From e35c26e9ec0d2d57f0e1e6ba8b5dbbd1491afe15 Mon Sep 17 00:00:00 2001 From: Angel Dimitrov Date: Tue, 11 Jun 2024 10:03:30 +0300 Subject: [PATCH] OXDEV-8315 Revert legacy infra static method --- src/Infrastructure/Legacy.php | 5 ++--- src/Service/Token.php | 3 +-- tests/PhpMd/phpmd.baseline.xml | 1 + 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Infrastructure/Legacy.php b/src/Infrastructure/Legacy.php index df791bf8..b277a012 100644 --- a/src/Infrastructure/Legacy.php +++ b/src/Infrastructure/Legacy.php @@ -14,7 +14,6 @@ use OxidEsales\Eshop\Core\Email; use OxidEsales\Eshop\Core\Model\ListModel as EshopListModel; use OxidEsales\Eshop\Core\Registry; -use OxidEsales\Eshop\Core\UtilsObject; use OxidEsales\EshopCommunity\Internal\Transition\Utility\ContextInterface; use OxidEsales\EshopCommunity\Internal\Utility\Email\EmailValidatorServiceInterface as EhopEmailValidator; use OxidEsales\GraphQL\Base\DataType\User; @@ -48,7 +47,7 @@ public function login(?string $username = null, ?string $password = null): User return new User($user, false); } - $user->setId($this->createUniqueIdentifier()); + $user->setId(self::createUniqueIdentifier()); return new User($user, true); } @@ -126,7 +125,7 @@ public function getUserGroupIds(?string $userId): array return $userGroupIds; } - public function createUniqueIdentifier(): string + public static function createUniqueIdentifier(): string { $utils = Registry::getUtilsObject(); return $utils->generateUId(); diff --git a/src/Service/Token.php b/src/Service/Token.php index 76b20d10..8e3c9984 100644 --- a/src/Service/Token.php +++ b/src/Service/Token.php @@ -14,7 +14,6 @@ use OxidEsales\GraphQL\Base\DataType\User as UserDataType; use OxidEsales\GraphQL\Base\Event\BeforeTokenCreation; use OxidEsales\GraphQL\Base\Exception\InvalidLogin; -use OxidEsales\GraphQL\Base\Exception\InvalidToken; use OxidEsales\GraphQL\Base\Exception\TokenQuota; use OxidEsales\GraphQL\Base\Exception\UnknownToken; use OxidEsales\GraphQL\Base\Infrastructure\Legacy; @@ -84,7 +83,7 @@ public function createToken(?string $username = null, ?string $password = null): ->withClaim(self::CLAIM_USERNAME, $user->email()) ->withClaim(self::CLAIM_USERID, $user->id()->val()) ->withClaim(self::CLAIM_USER_ANONYMOUS, $user->isAnonymous()) - ->withClaim(self::CLAIM_TOKENID, $this->legacyInfrastructure->createUniqueIdentifier()); + ->withClaim(self::CLAIM_TOKENID, Legacy::createUniqueIdentifier()); $event = new BeforeTokenCreation($builder, $user); $this->eventDispatcher->dispatch( diff --git a/tests/PhpMd/phpmd.baseline.xml b/tests/PhpMd/phpmd.baseline.xml index eaf07b17..9ec5cf22 100644 --- a/tests/PhpMd/phpmd.baseline.xml +++ b/tests/PhpMd/phpmd.baseline.xml @@ -8,4 +8,5 @@ +