you could also wrap the whole foreach into an if about '' === $this->idPrefix and else $routes = $names to avoid the loop