Skip to content

Commit

Permalink
chore: rename variable masterRequest to mainRequest and use explicit …
Browse files Browse the repository at this point in the history
…attributes from request in SalesChannelIdDetector
  • Loading branch information
tinect committed Jun 3, 2023
1 parent 9cfb71b commit 2af3a60
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/Service/SalesChannelIdDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,29 @@ public function __construct(

public function getSalesChannelId(): ?string
{
$masterRequest = $this->requestStack->getMainRequest();
$mainRequest = $this->requestStack->getMainRequest();

if ($masterRequest === null) {
if ($mainRequest === null) {
return null;
}

$salesChannelId = $masterRequest->attributes->get(PlatformRequest::ATTRIBUTE_SALES_CHANNEL_ID);
$salesChannelId = $mainRequest->attributes->get(PlatformRequest::ATTRIBUTE_SALES_CHANNEL_ID);

if (\is_string($salesChannelId)) {
return $salesChannelId;
}

if ($masterRequest->attributes->get('_route') === 'store-api.product.export') {
return $this->getSalesChannelIdByProductExport($masterRequest);
if ($mainRequest->attributes->get('_route') === 'store-api.product.export') {
return $this->getSalesChannelIdByProductExport($mainRequest);
}

return null;
}

private function getSalesChannelIdByProductExport(Request $masterRequest): ?string
private function getSalesChannelIdByProductExport(Request $mainRequest): ?string
{
$fileName = $masterRequest->get('fileName');
$accessKey = $masterRequest->get('accessKey');
$fileName = $mainRequest->attributes->get('fileName');
$accessKey = $mainRequest->attributes->get('accessKey');

if (!\is_string($fileName) || !\is_string($accessKey)) {
return null;
Expand Down

0 comments on commit 2af3a60

Please sign in to comment.