protected function getUserStoreToken(Context
$context): string
{ $contextSource =
$context->
getSource();
if (!
$contextSource instanceof AdminApiSource
) { throw new InvalidContextSourceException(AdminApiSource::
class,
$contextSource::
class);
} $userId =
$contextSource->
getUserId();
if ($userId === null
) { throw new InvalidContextSourceUserException($contextSource::
class);
} /** @var UserEntity|null $user */
$user =
$this->userRepository->
search(new Criteria([$userId]),
$context)->
first();
if ($user === null
) { throw new StoreTokenMissingException();
} $storeToken =
$user->
getStoreToken();
if ($storeToken === null
) {