Listing all selected terms for custom taxonomies on a post

$args = array( 'post_type' => 'inspirations', 'posts_per_page' => 10 );  
$loop = new WP_Query( $args );  

while ( $loop->have_posts() ) :
    $loop->the_post();  

    $collections="";
    foreach ( (array) wp_get_post_terms( get_the_ID(), 'collections') as $collection ) {
        if ( empty($collection->slug ) )
            continue;

        $collections .= ' collection-' . sanitize_html_class($collection->slug, $collection->term_id);
    }

    echo '<div class="inspirations-post '. $collections . '">';
        the_title();  
        echo '<div class="entry-content">';  
            the_excerpt();  
        echo '</div>';  
    echo '</div>';  
endwhile;