public function trimPath($path) {
        // Rewrite leading double slashes.
        $path = preg_replace("/^\/\//", "/", $path);

        // If there are more double slashes route is invalid.
        if (preg_match("/\/{2,}/", $path)) {
            throw new \Exception('Route path has invalid format ' . $path);
        }

        // Trim chars.
        return trim($path, " \t\n\r\0\x0B/");
    }
public function trimPath($path) {
        // Rewrite leading double slashes.
        $path = preg_replace("/^\/\//", "/", $path);

        // If there are more double slashes route is invalid.
        if (preg_match("/\/{2,}/", $path)) {
            throw new \Exception('Route path has invalid format ' . $path);
        }

        // Trim chars.
        return trim($path, " \t\n\r\0\x0B/");
    }
public function trimPath ( $ path ) { // Rewrite leading double slashes. $ path = preg_replace ( "/^\/\//" , "/" , $ path ) ; // If there are more double slashes route is invalid. if ( preg_match ( "/\/{2,}/" , $ path ) ) { throw new \ Exception ( 'Route path has invalid format ' . $ path ) ; } // Trim chars. return trim ( $ path , " \t\n\r\0\x0B/" ) ; }
Right and left trim route from blanks and undesired characters.

@param $path

@return string
@throws \Exception
Right and left trim route from blanks and undesired characters .