Skip to content

Commit c7b4aae

Browse files
author
Janak
committed
Fixed code as per given instrunction in codacy
1 parent 3d882cf commit c7b4aae

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

app/code/Magento/UrlRewrite/Model/StoreSwitcher/RewriteUrl.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,14 @@ public function switch(StoreInterface $fromStore, StoreInterface $targetStore, s
7171
UrlRewrite::TARGET_PATH => $oldRewrite->getTargetPath(),
7272
UrlRewrite::STORE_ID => $targetStore->getId(),
7373
]);
74-
7574
if (null === $currentRewrites || empty($currentRewrites)) {
7675
/** @var \Magento\Framework\App\Response\Http $response */
7776
$targetUrl = $targetStore->getBaseUrl();
78-
} else {
79-
foreach($currentRewrites as $rewrite) {
80-
$targetUrl = $targetStore->getBaseUrl() . $rewrite->getRequestPath();
81-
break;
82-
}
77+
return $targetUrl;
78+
}
79+
foreach ($currentRewrites as $rewrite) {
80+
$targetUrl = $targetStore->getBaseUrl() . $rewrite->getRequestPath();
81+
break;
8382
}
8483
}
8584

0 commit comments

Comments
 (0)