Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,8 @@ public function getPopupTitle()
$messageCount = count($this->_messages->getUnread());
if ($messageCount > 1) {
return __('You have %1 new system messages', $messageCount);
} else {
return __('You have %1 new system message', $messageCount);
}
return __('You have %1 new system message', $messageCount);
}

/**
Expand Down
3 changes: 1 addition & 2 deletions app/code/Magento/AdminNotification/Block/Window.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,9 @@ protected function _getLatestItem()
{
if ($this->_latestItem == null) {
$items = array_values($this->_criticalCollection->getItems());
$this->_latestItem = false;
if (count($items)) {
$this->_latestItem = $items[0];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ternary operator would fit better here.

} else {
$this->_latestItem = false;
}
}
return $this->_latestItem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -626,9 +626,8 @@ protected function _getCustomerGroupById(
): string {
if ($allGroups !== 0) {
return ImportAdvancedPricing::VALUE_ALL_GROUPS;
} else {
return $this->_groupRepository->getById($groupId)->getCode();
}
return $this->_groupRepository->getById($groupId)->getCode();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ternary operator would fit better here.

}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -482,9 +482,8 @@ protected function deleteProductTierPrices(array $listSku, $table)
$this->addRowError(ValidatorInterface::ERROR_SKU_IS_EMPTY, 0);
return false;
}
} else {
return false;
}
return false;
}

/**
Expand Down
7 changes: 1 addition & 6 deletions app/code/Magento/Analytics/Model/Config/Backend/Enabled.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,7 @@ public function afterSave()
try {
if ($this->isValueChanged()) {
$enabled = $this->getData('value');

if ($enabled) {
$this->subscriptionHandler->processEnabled();
} else {
$this->subscriptionHandler->processDisabled();
}
$enabled ? $this->subscriptionHandler->processEnabled() : $this->subscriptionHandler->processDisabled();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ternary operator is NOT really suitable here as it decreases code readability. it is better to be used in assignments only.

}
} catch (\Exception $e) {
$this->_logger->error($e->getMessage());
Expand Down
3 changes: 1 addition & 2 deletions app/code/Magento/Authorization/Model/ResourceModel/Role.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ protected function _beforeSave(\Magento\Framework\Model\AbstractModel $role)
}

if (!$role->getTreeLevel()) {
$treeLevel = 0;
if ($role->getPid() > 0) {
$select = $this->getConnection()->select()->from(
$this->getMainTable(),
Expand All @@ -79,8 +80,6 @@ protected function _beforeSave(\Magento\Framework\Model\AbstractModel $role)
$binds = ['pid' => (int)$role->getPid()];

$treeLevel = $this->getConnection()->fetchOne($select, $binds);
} else {
$treeLevel = 0;
}

$role->setTreeLevel($treeLevel + 1);
Expand Down