Thanks for your advice.  It's possible to extract the case statement into a single method, but then it becomes identical to the solution in #10887.  Is there a reason why you don't merge #10887 instead?