Check if tag, category or author on archive.php

you can use it just like you posted which is safe and would do the job just fine:

if (is_author())
{
    $author = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author));
}

elseif (is_category())
{
    //this will work in categories tags or custom taxonomy
    $term_slug = get_query_var( 'term' );
    $taxonomyName = get_query_var( 'taxonomy' );
    $current_term = get_term_by( 'slug', $term_slug, $taxonomyName );
}

else(is_tag())
{
    //this will work in categories tags or custom taxonomy
    $term_slug = get_query_var( 'term' );
    $taxonomyName = get_query_var( 'taxonomy' );
    $current_term = get_term_by( 'slug', $term_slug, $taxonomyName );
}

Now after that as been said i would only recommend this way if this theme is not going to be released to the public and is for your own use, if this theme is to be released then i would divide my code in to separate files for easier customization and keeping with theme structure standards.