Skip to content

Commit 71d4cd6

Browse files
authored
ENGCOM-7680: Update code to reduce redundancy and simplify readability #28608
2 parents 841cb8d + 3c65835 commit 71d4cd6

File tree

1 file changed

+7
-17
lines changed
  • lib/internal/Magento/Framework/App/Request

1 file changed

+7
-17
lines changed

lib/internal/Magento/Framework/App/Request/Http.php

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,7 @@ public function isDirectAccessFrontendName($code)
200200
public function getBasePath()
201201
{
202202
$path = parent::getBasePath();
203-
if (empty($path)) {
204-
$path = '/';
205-
} else {
206-
$path = str_replace('\\', '/', $path);
207-
}
208-
return $path;
203+
return empty($path) ? '/' : str_replace('\\', '/', $path);
209204
}
210205

211206
/**
@@ -298,10 +293,9 @@ public function getBeforeForwardInfo($name = null)
298293
{
299294
if ($name === null) {
300295
return $this->beforeForwardInfo;
301-
} elseif (isset($this->beforeForwardInfo[$name])) {
302-
return $this->beforeForwardInfo[$name];
303296
}
304-
return null;
297+
298+
return $this->beforeForwardInfo[$name] ?? null;
305299
}
306300

307301
/**
@@ -311,13 +305,9 @@ public function getBeforeForwardInfo($name = null)
311305
*/
312306
public function isAjax()
313307
{
314-
if ($this->isXmlHttpRequest()) {
315-
return true;
316-
}
317-
if ($this->getParam('ajax') || $this->getParam('isAjax')) {
318-
return true;
319-
}
320-
return false;
308+
return $this->isXmlHttpRequest()
309+
|| $this->getParam('ajax')
310+
|| $this->getParam('isAjax');
321311
}
322312

323313
/**
@@ -365,7 +355,7 @@ public static function getDistroBaseUrlPath($server)
365355
$result = '';
366356
if (isset($server['SCRIPT_NAME'])) {
367357
$envPath = str_replace('\\', '/', dirname(str_replace('\\', '/', $server['SCRIPT_NAME'])));
368-
if ($envPath != '.' && $envPath != '/') {
358+
if ($envPath !== '.' && $envPath !== '/') {
369359
$result = $envPath;
370360
}
371361
}

0 commit comments

Comments
 (0)