-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve code structure in relation to else / if statements. #14576
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ternary operator would fit better here. |
||
} | ||
|
||
/** | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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()); | ||
|
There was a problem hiding this comment.
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.