Site icon Hip-Hop Website Design and Development

Submit Class for Customized Taxonomy Error

I am getting two errors with the next code.
I am basically making an attempt to undergo all of the customized taxonomies and add them to the submit class.

Discover: Array to string conversion in
/Functions/MAMP/htdocs/Dev/wp-includes/taxonomy.php on line 3317

Discover: Array to string conversion in
/Functions/MAMP/htdocs/Dev/wp-includes/category-template.php on
line 1253

if ( ! function_exists('custom_taxonomy_class') ) {

    perform custom_taxonomy_class($lessons, $class, $ID) {

       $args = array(
         'public'   => true,
         '_builtin' => false

       ); 
       $output = 'names'; // or objects
       $operator = 'and'; // 'and' or 'or'

       $taxonomies = get_taxonomies( $args, $output, $operator ); 
       $phrases = get_the_terms( (int) $ID, (array)$taxonomies );

        if ( ! empty( $phrases ) ) {
            foreach ( (array) $phrases as $order => $time period ) {            
                if ( ! in_array( $term->slug, $lessons ) ) {
                    $lessons[] = $term->slug;
                }
            }
        }

       $lessons[] = '';

        return $lessons;
    }
}

add_filter( 'post_class', 'custom_taxonomy_class', 10, 3 );