private function createRegex($directiveUrlPath)
    {
        $hasMustEndWithWildcard = substr($directiveUrlPath, -1) === self::MUST_END_WITH_WILDCARD;
        if ($hasMustEndWithWildcard) {
            $directiveUrlPath = rtrim($directiveUrlPath, self::MUST_END_WITH_WILDCARD);
        }

        $directiveUrlPath = rtrim($directiveUrlPath, self::ANY_CHARACTER_WILDCARD);
        $directiveValueParts = explode(self::ANY_CHARACTER_WILDCARD, $directiveUrlPath);

        array_walk($directiveValueParts, function (&$directiveValue) {
            $directiveValue = preg_quote($directiveValue, '/');
        });

        return '/^' . implode(".*", $directiveValueParts) . ($hasMustEndWithWildcard ? '$' : '') . '/';
    }
private function createRegex($directiveUrlPath)
    {
        $hasMustEndWithWildcard = substr($directiveUrlPath, -1) === self::MUST_END_WITH_WILDCARD;
        if ($hasMustEndWithWildcard) {
            $directiveUrlPath = rtrim($directiveUrlPath, self::MUST_END_WITH_WILDCARD);
        }

        $directiveUrlPath = rtrim($directiveUrlPath, self::ANY_CHARACTER_WILDCARD);
        $directiveValueParts = explode(self::ANY_CHARACTER_WILDCARD, $directiveUrlPath);

        array_walk($directiveValueParts, function (&$directiveValue) {
            $directiveValue = preg_quote($directiveValue, '/');
        });

        return '/^' . implode(".*", $directiveValueParts) . ($hasMustEndWithWildcard ? '$' : '') . '/';
    }
private function createRegex ( $ directiveUrlPath ) { $ hasMustEndWithWildcard = substr ( $ directiveUrlPath , - 1 ) === self :: MUST_END_WITH_WILDCARD ; if ( $ hasMustEndWithWildcard ) { $ directiveUrlPath = rtrim ( $ directiveUrlPath , self :: MUST_END_WITH_WILDCARD ) ; } $ directiveUrlPath = rtrim ( $ directiveUrlPath , self :: ANY_CHARACTER_WILDCARD ) ; $ directiveValueParts = explode ( self :: ANY_CHARACTER_WILDCARD , $ directiveUrlPath ) ; array_walk ( $ directiveValueParts , function ( & $ directiveValue ) { $ directiveValue = preg_quote ( $ directiveValue , '/' ) ; } ) ; return '/^' . implode ( ".*" , $ directiveValueParts ) . ( $ hasMustEndWithWildcard ? '$' : '' ) . '/' ; }
Transform a directive URL path into an equivalent regex

@param string $directiveUrlPath

@return string
Transform a directive URL path into an equivalent regex