As `name()` involves some processing to obtain a result, please avoid calling it more than once inside a method. Use a variable to store the result instead. In this case, I think it's probably best to also use more array-based logic rather than string functions - similar to how I suggested re-implementing the above methods. So rather than testing for there being no separator in the name, test that there is only one part after exploding the name on any separators it contains.