/** * Returns true if Route matches input $uri and $method, false otherwise * @param IRoute $route * @param string $uri * @param string $method * @return bool */ private function isRouteAMatch(IRoute $route, \string $uri, \string $method) : \bool { if ($route->getMethod() == $method) { if ($route->getUri() == $uri) { return true; } $routeUriArray = $this->sliceUri($route->getUri()); $inputUriArray = $this->sliceUri($uri); return $this->compareSegmentLists($routeUriArray, $inputUriArray); } return false; }
/** * Removes a route from collection * @param IRoute|string $route * @return RouteCollection */ public function remove($route) : RouteCollection { $key = $route instanceof Route ? $route->getUri() : $route; $this->offsetUnset($key); return $this; }