public function getPathWithoutPrefix() { $prefix = Config::getValue('global', 'prefix_system'); $path = Strings::removePrefix($this->getPath(), $prefix); if (preg_match('#.+/$#', $path)) { $path = rtrim($path, '/'); } return $path; }
/** * @return RouteRule * @throws RouterException */ public function findRoute() { $path = $this->uri->getPathWithoutPrefix(); $requestType = Uri::getRequestType(); $rule = $this->findRouteRule($path, $requestType); if (!$rule) { throw new RouterException('No route rule found for HTTP method [' . $requestType . '] and URI [' . $path . ']'); } $rule->setParameters($path); return $rule; }