Skip to content

Instantly share code, notes, and snippets.

@machuga
Created October 20, 2011 13:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save machuga/1301105 to your computer and use it in GitHub Desktop.
Save machuga/1301105 to your computer and use it in GitHub Desktop.
<?php
public function new_badges() {
return array_map( function($level) {
return array(
'title' => $level['end_user_title'] ?: $level['pub_title'],
'description' => $level['end_user_description'] ?: $pub['description'],
'url' => array_reduce($level['urls'], function ($url, $url_o) {
return ! $url && $url_o['is_media_url'] && $url_o['is_for_end_user'] ? $url_o : $url;
}, null),
);
}, array_filter($this->level_summaries(), function ($level) { return $level['leveled_up']; }));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment