public function routeExists($path) { $routeName = ltrim($path, '/'); return isset($this->routes[$routeName]); }