public function createRegexFromName(string $name) : string
    {
        $route = $this->routeCollection->getNamedRoute($name);

        if ($route === null) {
            return '#^.*$#';
        }

        $strippedPathRegex = substr($route->getPathRegex(), 2, -2);

        if (empty($route->getRawHost())) {
            return "#^$strippedPathRegex$#";
        }

        $protocolRegex = preg_quote('http' . ($route->isSecure() ? 's' : '') . '://', '#');
        $strippedHostRegex = substr($route->getHostRegex(), 2, -2);

        return "#^$protocolRegex$strippedHostRegex$strippedPathRegex$#";
    }
public function createRegexFromName(string $name) : string
    {
        $route = $this->routeCollection->getNamedRoute($name);

        if ($route === null) {
            return '#^.*$#';
        }

        $strippedPathRegex = substr($route->getPathRegex(), 2, -2);

        if (empty($route->getRawHost())) {
            return "#^$strippedPathRegex$#";
        }

        $protocolRegex = preg_quote('http' . ($route->isSecure() ? 's' : '') . '://', '#');
        $strippedHostRegex = substr($route->getHostRegex(), 2, -2);

        return "#^$protocolRegex$strippedHostRegex$strippedPathRegex$#";
    }
public function createRegexFromName ( string $ name ) : string { $ route = $ this -> routeCollection -> getNamedRoute ( $ name ) ; if ( $ route === null ) { return '#^.*$#' ; } $ strippedPathRegex = substr ( $ route -> getPathRegex ( ) , 2 , - 2 ) ; if ( empty ( $ route -> getRawHost ( ) ) ) { return "#^$strippedPathRegex$#" ; } $ protocolRegex = preg_quote ( 'http' . ( $ route -> isSecure ( ) ? 's' : '' ) . '://' , '#' ) ; $ strippedHostRegex = substr ( $ route -> getHostRegex ( ) , 2 , - 2 ) ; return "#^$protocolRegex$strippedHostRegex$strippedPathRegex$#" ; }
Creates a URL regex for the named route

@param string $name The named of the route whose URL regex we're generating
@return string The generated URL regex
@throws URLException Thrown if there was an error generating the URL regex
Creates a URL regex for the named route