Skip to content

Instantly share code, notes, and snippets.

@dypsilon
Created June 5, 2011 00:08
Show Gist options
  • Save dypsilon/1008517 to your computer and use it in GitHub Desktop.
Save dypsilon/1008517 to your computer and use it in GitHub Desktop.
Guard Clause
<?php
foreach ($navigation['nodes'] as $node) {
$node['isActive'] = false;
if(empty($node['url'])) {
continue;
}
if(!$node['isVisible']) {
continue;
}
$node['isActive'] = ($node['url'] === $currentUrl);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment