Skip to content

Commit 79ce234

Browse files
committed
code review fixes
1 parent e0397d6 commit 79ce234

File tree

7 files changed

+11
-11
lines changed

7 files changed

+11
-11
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -776,8 +776,8 @@ protected function getImageFile()
776776
*/
777777
protected function parseSize($string)
778778
{
779-
$size = $string ? explode('x', strtolower($string)) : [''];
780-
if (count($size) == 2) {
779+
$size = $string !== null ? explode('x', strtolower($string)) : [];
780+
if (count($size) === 2) {
781781
return ['width' => $size[0] > 0 ? $size[0] : null, 'height' => $size[1] > 0 ? $size[1] : null];
782782
}
783783
return false;

app/code/Magento/Catalog/Model/Category.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,7 @@ public function getPathIds()
846846
{
847847
$ids = $this->getData('path_ids');
848848
if ($ids === null) {
849-
$ids = $this->getPath() ? explode('/', $this->getPath()) : [''];
849+
$ids = $this->getPath() ? explode('/', $this->getPath()) : [];
850850
$this->setData('path_ids', $ids);
851851
}
852852
return $ids;
@@ -860,7 +860,7 @@ public function getPathIds()
860860
public function getLevel()
861861
{
862862
if (!$this->hasLevel()) {
863-
return $this->getPath() ? (count(explode('/', $this->getPath())) - 1) : 0;
863+
return $this->getPath() ? count(explode('/', $this->getPath())) - 1 : 0;
864864
}
865865
return $this->getData(self::KEY_LEVEL);
866866
}

app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/DataProvider.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ private function getAttributeValue($attributeId, $valueIds, $storeId)
574574
if (false !== $value) {
575575
$optionValue = $this->getAttributeOptionValue($attributeId, $valueIds, $storeId);
576576
if (null === $optionValue) {
577-
$value = ($value !== null) ? $this->filterAttributeValue($value) : '';
577+
$value = $value !== null ? $this->filterAttributeValue($value) : '';
578578
} else {
579579
$value = implode($this->separator, array_filter([$value, $optionValue]));
580580
}
@@ -594,7 +594,7 @@ private function getAttributeValue($attributeId, $valueIds, $storeId)
594594
private function getAttributeOptionValue($attributeId, $valueIds, $storeId)
595595
{
596596
$optionKey = $attributeId . '-' . $storeId;
597-
$attributeValueIds = ($valueIds !== null) ? explode(',', $valueIds) : [''];
597+
$attributeValueIds = $valueIds !== null ? explode(',', $valueIds) : [];
598598
$attributeOptionValue = '';
599599
if (!array_key_exists($optionKey, $this->attributeOptions)
600600
) {
@@ -608,7 +608,7 @@ private function getAttributeOptionValue($attributeId, $valueIds, $storeId)
608608
$this->attributeOptions[$optionKey] = array_column($options, 'label', 'value');
609609
$this->attributeOptions[$optionKey] = array_map(
610610
function ($value) {
611-
return ($value !== null) ? $this->filterAttributeValue($value) : '';
611+
return $value !== null ? $this->filterAttributeValue($value) : '';
612612
},
613613
$this->attributeOptions[$optionKey]
614614
);

app/code/Magento/Quote/Model/Quote/Address.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1453,7 +1453,7 @@ public function setCountryId($countryId)
14531453
public function getStreet()
14541454
{
14551455
$street = $this->getData(self::KEY_STREET);
1456-
if (!$street) {
1456+
if ($street === null) {
14571457
return [''];
14581458
}
14591459
return is_array($street) ? $street : explode("\n", $street);

app/code/Magento/Tax/Model/ResourceModel/Calculation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ protected function _createSearchPostCodeTemplates($postcode, $exactPostcode = nu
229229
{
230230
// as needed, reduce the postcode to the correct length
231231
$len = $this->_taxData->getPostCodeSubStringLength();
232-
$postcode = ($postcode !== null) ? substr($postcode, 0, $len) : '';
232+
$postcode = $postcode !== null ? substr($postcode, 0, $len) : '';
233233

234234
// begin creating the search template array
235235
$strArr = [$postcode, $postcode . '*'];

lib/internal/Magento/Framework/Filter/Translit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ protected function getConvertTable()
531531
*/
532532
public function filter($string)
533533
{
534-
$string = ($string !== null) ? strtr($string, $this->getConvertTable()) : '';
534+
$string = $string !== null ? strtr($string, $this->getConvertTable()) : '';
535535
return '"libiconv"' == ICONV_IMPL ? iconv(
536536
\Magento\Framework\Stdlib\StringUtils::ICONV_CHARSET,
537537
'ascii//ignore//translit',

lib/internal/Magento/Framework/Stdlib/StringUtils.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public function strlen($string)
160160
*/
161161
public function cleanString($string)
162162
{
163-
return ($string !== null) ? mb_convert_encoding($string, self::ICONV_CHARSET) : '';
163+
return $string !== null ? mb_convert_encoding($string, self::ICONV_CHARSET) : '';
164164
}
165165

166166
/**

0 commit comments

Comments
 (0)