Update Router.php

Cleaned up method using @KennedyTedesco's suggestion.