/** * Generates the host portion of a URL for a route * * @param ParsedRoute $route The route whose URL we're generating * @param mixed|array $values The value or list of values to fill the route with * @return string The generated host value * @throws URLException Thrown if the generated host is not valid */ private function generateHost(ParsedRoute $route, &$values) { $host = ""; if (!empty($route->getRawHost())) { $host = $this->generateUrlPart($route->getRawHost(), $route->getHostRegex(), $route->getName(), $values); // Prefix the URL with the protocol $host = "http" . ($route->isSecure() ? "s" : "") . "://" . $host; } return $host; }
/** * @inheritdoc */ public function isMatch(ParsedRoute $route, Request $request) { return $route->isSecure() && $request->isSecure() || !$route->isSecure(); }