-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Simplified spaghetti code #8544
Conversation
Removed duplicated code
// Set the selected skin | ||
if ($app->isSite()) | ||
// Set the selected skin in the current side, front-end or back-end | ||
$side = $app->getClientId() ? 'skin_admin' : 'skin'; |
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.
I would use $app->isAdmin(), because it is better readable
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.
I agree @rdeutz, in this case $app->isAdmin()
would be more appropriate.
Changed getClientId() with isAdmin() as per request
Hi @rdeutz I have changed getClientId() with isAdmin() as per request. |
if ($app->isSite()) | ||
// Set the selected skin in the current side, front-end or back-end | ||
$side = $app->isAdmin() ? 'skin_admin' : 'skin'; | ||
if ((int) $this->params->get($side, 0) < count($skindirs)) |
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.
CS: Blank line before if
statement.
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.
(int) $this->params->get($side, 0)
is used twice. Can be refactored.
@test success |
The if (isset($skindirs[$index])) or whole thing as a ternary, maybe! $side = $app->isAdmin() ? 'skin_admin' : 'skin';
$index = (int) $this->params->get($side, 0);
$skin = isset($skindirs[$index]) ? basename($skindirs[$index]) : 'lightgray';
$skin = 'skin : "' . $skin . '",'; Yours is good too. I'm just suggesting. 👍 |
What is the status? This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8544. |
IMO, This is most of a code review. However the current code (without this patch) would break in the case where Or you can create a third application similar to administrator with |
I have tested this item ✅ successfully on 3ed4624 This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8544. |
I have tested this item ✅ successfully on 3ed4624 This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8544. |
@demis-palma Could you make the suggested changes please? |
Removed duplicated code