if-else statement to switch case

Comment From: leeseojune53

I don't know why the code style fails.

Comment From: philwebb

This is shaded code from another project so we don't want to make any changes to it.