Comments

pillarsdotnet’s picture

Status: Active » Needs review
StatusFileSize
new7.06 KB

Patch

mehrpadin’s picture

Hey Bob,

I'm not sure what this is for, do you mean that the array_filter does not work?

pillarsdotnet’s picture

Category: bug » task
Priority: Normal » Minor

(looking...)

I missed the array_filter() call; sorry.

(looking some more...)

It's a style change, not a functional change. We may have very different ideas of what good code ought to look like.

I find the following construct ugly:

  $foo .= ($condition) ? $something : '';

I like this construct better, even though it is slightly more verbose:

if ($condition) {
  $foo .= $something
}

I find this construct especially offensive:

$foo .= ($condition) ? $thing1 : '';
$foo .= ($condition) ? $thing2 : '';
$foo .= ($condition) ? $thing3 : '';

I'd much rather factor out the common condition, even though again, it adds a couple of code lines:

if ($condition) {
  $foo .= $thing1;
  $foo .= $thing2;
  $foo .= $thing3;
}

But again, this is a personal style issue that has nothing to do with Drupal coding standards. Your way results in fewer code lines, and may even be more efficient, given PHP's weird optimization behavior.

In the likely event that you disagree with my suggestions, feel free to mark this Closed (works as designed).

It's your project, after all.

mehrpadin’s picture

Status: Needs review » Closed (works as designed)