Just a Q2A Core question. Is there any particular reason to have so similar different methods in these classes?
qa-app-posts.php (line 329)
// Return the handle corresponding to $userid, unless it is null in which case return null
function qa_post_userid_to_handle($userid) {
if (isset($userid)) {
if (QA_FINAL_EXTERNAL_USERS) {
require_once QA_INCLUDE_DIR.'qa-app-users.php';
$handles=qa_get_public_from_userids(array($userid));
return @$handles[$userid];
} else {
$user=qa_db_single_select(qa_db_user_account_selectspec($userid, true));
if (!is_array($user))
qa_fatal_error('User ID could not be found: '.$userid);
return $user['handle'];
}
}
return null;
}
qa-app-users.php (line 616)
// Return an array mapping each userid in $userids to that user's handle (public username), or to null if not found
function qa_userids_to_handles($userids) {
if (QA_FINAL_EXTERNAL_USERS)
$rawuseridhandles=qa_get_public_from_userids($userids);
else {
require_once QA_INCLUDE_DIR.'qa-db-users.php';
$rawuseridhandles=qa_db_user_get_userid_handles($userids);
}
$gotuseridhandles=array();
foreach ($userids as $userid)
$gotuseridhandles[$userid]=@$rawuseridhandles[$userid];
return $gotuseridhandles;
}
If the intention was to overload a method that received an array into one that could also receive an int, the best approach I can think of to enforce code reuse, would be to check the paramter type (eg: is_array()). Or maybe I'm missing something :)