This kind of code drives me nuts…
if (!($log->HasDownloaded())) {
// do stuff
} else {
// do other stuff
}
Just take out the extra characters to make it more legible at first glance and flip the conditional code…
if ($log->HasDownloaded()) {
// do other stuff
} else {
// do stuff
}
This is even better, no question what’s happening or when…
if ($log->has_downloaded() === TRUE)
{
// do other stuff
}
else
{
// do stuff
}
Yes, somebody else will skim your code in the future.
Add a comment
Post