@mattwynne the question is what you want to fix here, what functionality want to provide?
The code in question looks like "if I have scenario then I need its name else I have scenario outline and I need a lot  of information" imho it is hard to replace such code until you have better wording for the code.