protected function filterPath(string $path = null): string
	{
		$orig = $path;

		// Decode/normalize percent-encoded chars so
		// we can always have matching for Routes, etc.
		$path = urldecode($path);

		// Remove dot segments
		$path = $this->removeDotSegments($path);

		// Fix up some leading slash edge cases...
		if (strpos($orig, './') === 0)
		{
			$path = '/' . $path;
		}
		if (strpos($orig, '../') === 0)
		{
			$path = '/' . $path;
		}

		// Encode characters
		$path = preg_replace_callback(
				'/(?:[^' . static::CHAR_UNRESERVED . ':@&=\+\$,\/;%]+|%(?![A-Fa-f0-9]{2}))/', function (array $matches) {
					return rawurlencode($matches[0]);
				}, $path
		);

		return $path;
	}
protected function filterPath(string $path = null): string
	{
		$orig = $path;

		// Decode/normalize percent-encoded chars so
		// we can always have matching for Routes, etc.
		$path = urldecode($path);

		// Remove dot segments
		$path = $this->removeDotSegments($path);

		// Fix up some leading slash edge cases...
		if (strpos($orig, './') === 0)
		{
			$path = '/' . $path;
		}
		if (strpos($orig, '../') === 0)
		{
			$path = '/' . $path;
		}

		// Encode characters
		$path = preg_replace_callback(
				'/(?:[^' . static::CHAR_UNRESERVED . ':@&=\+\$,\/;%]+|%(?![A-Fa-f0-9]{2}))/', function (array $matches) {
					return rawurlencode($matches[0]);
				}, $path
		);

		return $path;
	}
protected function filterPath ( string $ path = null ) : string { $ orig = $ path ; // Decode/normalize percent-encoded chars so // we can always have matching for Routes, etc. $ path = urldecode ( $ path ) ; // Remove dot segments $ path = $ this -> removeDotSegments ( $ path ) ; // Fix up some leading slash edge cases... if ( strpos ( $ orig , './' ) === 0 ) { $ path = '/' . $ path ; } if ( strpos ( $ orig , '../' ) === 0 ) { $ path = '/' . $ path ; } // Encode characters $ path = preg_replace_callback ( '/(?:[^' . static :: CHAR_UNRESERVED . ':@&=\+\$,\/;%]+|%(?![A-Fa-f0-9]{2}))/' , function ( array $ matches ) { return rawurlencode ( $ matches [ 0 ] ) ; } , $ path ) ; return $ path ; }
Encodes any dangerous characters, and removes dot segments.
While dot segments have valid uses according to the spec,
this URI class does not allow them.

@param $path

@return string
Encodes any dangerous characters and removes dot segments . While dot segments have valid uses according to the spec this URI class does not allow them .