Added hasName method to Router as requested in issue #4784

Just a quick addition from a request. Let me know if anything needs to be added or otherwise modified.
There should be a space before the `(` and the `{` must be on a new line.