Skip to content

Commit dc8cd62

Browse files
author
Stanislav Idolov
authored
ENGCOM-2366: clean code #16841
2 parents 081e7ad + 889ce00 commit dc8cd62

File tree

31 files changed

+40
-47
lines changed

31 files changed

+40
-47
lines changed

app/code/Magento/Analytics/ReportXml/ReportProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function __construct(
5757
private function getIteratorName(Query $query)
5858
{
5959
$config = $query->getConfig();
60-
return isset($config['iterator']) ? $config['iterator'] : null;
60+
return $config['iterator'] ?? null;
6161
}
6262

6363
/**

app/code/Magento/Backend/App/DefaultPath.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,6 @@ public function __construct(\Magento\Backend\App\ConfigInterface $config)
4242
*/
4343
public function getPart($code)
4444
{
45-
return isset($this->_parts[$code]) ? $this->_parts[$code] : null;
45+
return $this->_parts[$code] ?? null;
4646
}
4747
}

app/code/Magento/Backend/Model/Menu/Builder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,6 @@ public function getResult(\Magento\Backend\Model\Menu $menu)
102102
*/
103103
protected function _getParam($params, $paramName, $defaultValue = null)
104104
{
105-
return isset($params[$paramName]) ? $params[$paramName] : $defaultValue;
105+
return $params[$paramName] ?? $defaultValue;
106106
}
107107
}

app/code/Magento/Backup/Helper/Data.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public function getBackupsDir()
110110
public function getExtensionByType($type)
111111
{
112112
$extensions = $this->getExtensions();
113-
return isset($extensions[$type]) ? $extensions[$type] : '';
113+
return $extensions[$type] ?? '';
114114
}
115115

116116
/**

app/code/Magento/BundleImportExport/Model/Export/RowCustomizer.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ function ($title, $storeName) {
321321
*/
322322
protected function getTypeValue($type)
323323
{
324-
return isset($this->typeMapping[$type]) ? $this->typeMapping[$type] : self::VALUE_DYNAMIC;
324+
return $this->typeMapping[$type] ?? self::VALUE_DYNAMIC;
325325
}
326326

327327
/**
@@ -332,7 +332,7 @@ protected function getTypeValue($type)
332332
*/
333333
protected function getPriceViewValue($type)
334334
{
335-
return isset($this->priceViewMapping[$type]) ? $this->priceViewMapping[$type] : self::VALUE_PRICE_RANGE;
335+
return $this->priceViewMapping[$type] ?? self::VALUE_PRICE_RANGE;
336336
}
337337

338338
/**
@@ -343,7 +343,7 @@ protected function getPriceViewValue($type)
343343
*/
344344
protected function getPriceTypeValue($type)
345345
{
346-
return isset($this->priceTypeMapping[$type]) ? $this->priceTypeMapping[$type] : null;
346+
return $this->priceTypeMapping[$type] ?? null;
347347
}
348348

349349
/**
@@ -354,7 +354,7 @@ protected function getPriceTypeValue($type)
354354
*/
355355
private function getShipmentTypeValue($type)
356356
{
357-
return isset($this->shipmentTypeMapping[$type]) ? $this->shipmentTypeMapping[$type] : null;
357+
return $this->shipmentTypeMapping[$type] ?? null;
358358
}
359359

360360
/**

app/code/Magento/Captcha/Observer/CaptchaStringResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ public function resolve(\Magento\Framework\App\RequestInterface $request, $formI
1818
{
1919
$captchaParams = $request->getPost(\Magento\Captcha\Helper\Data::INPUT_NAME_FIELD_VALUE);
2020

21-
return isset($captchaParams[$formId]) ? $captchaParams[$formId] : '';
21+
return $captchaParams[$formId] ?? '';
2222
}
2323
}

app/code/Magento/Catalog/Block/Product/View/Gallery.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ public function getImageAttribute($imageId, $attributeName, $default = null)
175175
{
176176
$attributes =
177177
$this->getConfigView()->getMediaAttributes('Magento_Catalog', Image::MEDIA_TYPE_CONFIG_NODE, $imageId);
178-
return isset($attributes[$attributeName]) ? $attributes[$attributeName] : $default;
178+
return $attributes[$attributeName] ?? $default;
179179
}
180180

181181
/**

app/code/Magento/Catalog/Cron/FrontendActionsFlush.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ private function getLifeTimeByNamespace($namespace)
5757
];
5858
}
5959

60-
return isset($configuration['lifetime']) ?
61-
(int) $configuration['lifetime'] : FrontendStorageConfigurationInterface::DEFAULT_LIFETIME;
60+
return (int)$configuration['lifetime'] ?? FrontendStorageConfigurationInterface::DEFAULT_LIFETIME;
6261
}
6362

6463
/**

app/code/Magento/Catalog/Helper/Image.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,7 @@ public function getFrame()
859859
*/
860860
protected function getAttribute($name)
861861
{
862-
return isset($this->attributes[$name]) ? $this->attributes[$name] : null;
862+
return $this->attributes[$name] ?? null;
863863
}
864864

865865
/**

app/code/Magento/Catalog/Helper/Output.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public function addHandler($method, $handler)
105105
public function getHandlers($method)
106106
{
107107
$method = strtolower($method);
108-
return isset($this->_handlers[$method]) ? $this->_handlers[$method] : [];
108+
return $this->_handlers[$method] ?? [];
109109
}
110110

111111
/**

0 commit comments

Comments
 (0)