Skip to content

Commit

Permalink
OXDEV-8315 Revert legacy infra static method
Browse files Browse the repository at this point in the history
  • Loading branch information
angel-dimitrov committed Jun 11, 2024
1 parent e6c8eaa commit e35c26e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/Infrastructure/Legacy.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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();
Expand Down
3 changes: 1 addition & 2 deletions src/Service/Token.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions tests/PhpMd/phpmd.baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
<violation rule="PHPMD\Rule\CleanCode\StaticAccess" file="src/Infrastructure/Legacy.php"/>
<violation rule="PHPMD\Rule\CleanCode\StaticAccess" file="src/Service/JwtConfigurationBuilder.php"/>
<violation rule="PHPMD\Rule\CleanCode\StaticAccess" file="src/Service/ModuleConfiguration.php"/>
<violation rule="PHPMD\Rule\CleanCode\StaticAccess" file="src/Service/Token.php"/>
</phpmd-baseline>

0 comments on commit e35c26e

Please sign in to comment.