No Code Attached Yet
avatar brianteeman
brianteeman
14 Sep 2023

We have quite a few instances of if statements being wrapped in an if statement. Surely the two conditions should be combined into a single if??

Example

if (!$this->getCurrentUser()->authorise('core.admin', $data['extension'])) {
if (isset($data['rules'])) {
unset($data['rules']);
}
}

 if (!$this->getCurrentUser()->authorise('core.admin', $data['extension']) && isset($data['rules']) { 
      unset($data['rules']); 
 }
avatar brianteeman brianteeman - open - 14 Sep 2023
avatar joomla-cms-bot joomla-cms-bot - change - 14 Sep 2023
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 14 Sep 2023
avatar alikon
alikon - comment - 15 Sep 2023

the 1st one is more readable imho

avatar Quy
Quy - comment - 15 Sep 2023

Each expression on its own line should make it as readable.

        if (
            !$this->getCurrentUser()->authorise('core.admin', $data['extension'])
            && isset($data['rules'])
        ) {
            unset($data['rules']);
        }
avatar skbhagat0502
skbhagat0502 - comment - 15 Sep 2023

I am working in this issue.

avatar brianteeman brianteeman - close - 27 Sep 2023
avatar brianteeman brianteeman - change - 27 Sep 2023
Status New Closed
Closed_Date 0000-00-00 00:00:00 2023-09-27 18:45:42
Closed_By brianteeman

Add a Comment

Login with GitHub to post a comment