Skip to content

Commit

Permalink
ENGCOM-7680: Update code to reduce redundancy and simplify readability
Browse files Browse the repository at this point in the history
…#28608

 - Merge Pull Request #28608 from df2k2/magento2:patch-1
 - Merged commits:
   1. 01309d8
   2. 45a668a
   3. 0a1b76a
   4. 910da38
   5. 9009851
   6. 9b954c0
   7. eaba8c2
   8. 7e7b645
  • Loading branch information
magento-engcom-team committed Aug 4, 2020
2 parents 796906f + 7e7b645 commit 3c65835
Showing 1 changed file with 7 additions and 17 deletions.
24 changes: 7 additions & 17 deletions lib/internal/Magento/Framework/App/Request/Http.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,7 @@ public function isDirectAccessFrontendName($code)
public function getBasePath()
{
$path = parent::getBasePath();
if (empty($path)) {
$path = '/';
} else {
$path = str_replace('\\', '/', $path);
}
return $path;
return empty($path) ? '/' : str_replace('\\', '/', $path);
}

/**
Expand Down Expand Up @@ -298,10 +293,9 @@ public function getBeforeForwardInfo($name = null)
{
if ($name === null) {
return $this->beforeForwardInfo;
} elseif (isset($this->beforeForwardInfo[$name])) {
return $this->beforeForwardInfo[$name];
}
return null;

return $this->beforeForwardInfo[$name] ?? null;
}

/**
Expand All @@ -311,13 +305,9 @@ public function getBeforeForwardInfo($name = null)
*/
public function isAjax()
{
if ($this->isXmlHttpRequest()) {
return true;
}
if ($this->getParam('ajax') || $this->getParam('isAjax')) {
return true;
}
return false;
return $this->isXmlHttpRequest()
|| $this->getParam('ajax')
|| $this->getParam('isAjax');
}

/**
Expand Down Expand Up @@ -365,7 +355,7 @@ public static function getDistroBaseUrlPath($server)
$result = '';
if (isset($server['SCRIPT_NAME'])) {
$envPath = str_replace('\\', '/', dirname(str_replace('\\', '/', $server['SCRIPT_NAME'])));
if ($envPath != '.' && $envPath != '/') {
if ($envPath !== '.' && $envPath !== '/') {
$result = $envPath;
}
}
Expand Down

0 comments on commit 3c65835

Please sign in to comment.