Skip to content

Instantly share code, notes, and snippets.

@blissdev
Last active December 14, 2015 00:59
Show Gist options
  • Save blissdev/5002642 to your computer and use it in GitHub Desktop.
Save blissdev/5002642 to your computer and use it in GitHub Desktop.
$sortByPriority = function($app1, $app2) use ($resident) {
$priority1 = $app1->getResidentApplication($resident)->priority();
$priority2 = $app2->getResidentApplication($resident)->priority();
if(is_null($priority1) && is_null($priority2)) {
return 0;
}
var_dump($priority1); var_dump($priority2);
exit();
if(is_null($priority1)) return -1;
if(is_null($priority2)) return 1;
if($priority1 > $priority2) return 1;
if($priority1 < $priority2) return -1;
return 0;
};
// apps with dependencies who have been started
$output['startedWithDependencies'] = array_filter($applicationTemplates, function($app) use ($resident) {
return !$app->dependencies()->isEmpty() && $app->getResidentApplication($resident);
});
usort($output['startedWithDependencies'], $sortByPriority);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment