protected function preprocessPathString($path)
    {
        // If the path is null, make sure to give it our match-all value
        $path = (null === $path) ? static::NULL_PATH_VALUE : (string) $path;

        // If a custom regular expression (or negated custom regex)
        if ($this->namespace &&
            (isset($path[0]) && $path[0] === '@') ||
            (isset($path[0]) && $path[0] === '!' && isset($path[1]) && $path[1] === '@')
        ) {
            // Is it negated?
            if ($path[0] === '!') {
                $negate = true;
                $path = substr($path, 2);
            } else {
                $negate = false;
                $path = substr($path, 1);
            }

            // Regex anchored to front of string
            if ($path[0] === '^') {
                $path = substr($path, 1);
            } else {
                $path = '.*' . $path;
            }

            if ($negate) {
                $path = '@^' . $this->namespace . '(?!' . $path . ')';
            } else {
                $path = '@^' . $this->namespace . $path;
            }

        } elseif ($this->namespace && $this->pathIsNull($path)) {
            // Empty route with namespace is a match-all
            $path = '@^' . $this->namespace . '(/|$)';
        } else {
            // Just prepend our namespace
            $path = $this->namespace . $path;
        }

        return $path;
    }
protected function preprocessPathString($path)
    {
        // If the path is null, make sure to give it our match-all value
        $path = (null === $path) ? static::NULL_PATH_VALUE : (string) $path;

        // If a custom regular expression (or negated custom regex)
        if ($this->namespace &&
            (isset($path[0]) && $path[0] === '@') ||
            (isset($path[0]) && $path[0] === '!' && isset($path[1]) && $path[1] === '@')
        ) {
            // Is it negated?
            if ($path[0] === '!') {
                $negate = true;
                $path = substr($path, 2);
            } else {
                $negate = false;
                $path = substr($path, 1);
            }

            // Regex anchored to front of string
            if ($path[0] === '^') {
                $path = substr($path, 1);
            } else {
                $path = '.*' . $path;
            }

            if ($negate) {
                $path = '@^' . $this->namespace . '(?!' . $path . ')';
            } else {
                $path = '@^' . $this->namespace . $path;
            }

        } elseif ($this->namespace && $this->pathIsNull($path)) {
            // Empty route with namespace is a match-all
            $path = '@^' . $this->namespace . '(/|$)';
        } else {
            // Just prepend our namespace
            $path = $this->namespace . $path;
        }

        return $path;
    }
protected function preprocessPathString ( $ path ) { // If the path is null, make sure to give it our match-all value $ path = ( null === $ path ) ? static :: NULL_PATH_VALUE : ( string ) $ path ; // If a custom regular expression (or negated custom regex) if ( $ this -> namespace && ( isset ( $ path [ 0 ] ) && $ path [ 0 ] === '@' ) || ( isset ( $ path [ 0 ] ) && $ path [ 0 ] === '!' && isset ( $ path [ 1 ] ) && $ path [ 1 ] === '@' ) ) { // Is it negated? if ( $ path [ 0 ] === '!' ) { $ negate = true ; $ path = substr ( $ path , 2 ) ; } else { $ negate = false ; $ path = substr ( $ path , 1 ) ; } // Regex anchored to front of string if ( $ path [ 0 ] === '^' ) { $ path = substr ( $ path , 1 ) ; } else { $ path = '.*' . $ path ; } if ( $ negate ) { $ path = '@^' . $ this -> namespace . '(?!' . $ path . ')' ; } else { $ path = '@^' . $ this -> namespace . $ path ; } } elseif ( $ this -> namespace && $ this -> pathIsNull ( $ path ) ) { // Empty route with namespace is a match-all $ path = '@^' . $ this -> namespace . '(/|$)' ; } else { // Just prepend our namespace $ path = $ this -> namespace . $ path ; } return $ path ; }
Pre-process a path string

This method wraps the path string in a regular expression syntax baesd
on whether the string is a catch-all or custom regular expression.
It also adds the namespace in a specific part, based on the style of expression

@param string $path
@return string
Pre - process a path string