/** * @param string $pattern * @param IUrl $url * @param string $key * * @return string */ protected function setProtocol($pattern, IUrl $url, $key = ':scheme') { $scheme = $url->getProtocol(); if ($scheme) { $scheme = s('%s://', $scheme); } $pattern = s($pattern, [$key => $scheme]); return $pattern; }