Custom post type change excerpt more and excerpt length

you made it complex a bit i used this simple lines of code;

add_filter('excerpt_length', function ($length) {
    global $post;
    if ($post->post_type == 'portfolio'){
        return 13;
    }
    return 50;
}, 100);