@@ 639-650 (lines=12) @@ | ||
636 | * |
|
637 | * @throws \InvalidArgumentException If the path is invalid. |
|
638 | */ |
|
639 | private function filterPath($path) |
|
640 | { |
|
641 | if (!is_string($path)) { |
|
642 | throw new \InvalidArgumentException('Path must be a string'); |
|
643 | } |
|
644 | ||
645 | return preg_replace_callback( |
|
646 | '/(?:[^' . self::$charUnreserved . self::$charSubDelims . '%:@\/]++|%(?![A-Fa-f0-9]{2}))/', |
|
647 | [$this, 'rawurlencodeMatchZero'], |
|
648 | $path |
|
649 | ); |
|
650 | } |
|
651 | ||
652 | /** |
|
653 | * Filters the query string or fragment of a URI. |
|
@@ 661-672 (lines=12) @@ | ||
658 | * |
|
659 | * @throws \InvalidArgumentException If the query or fragment is invalid. |
|
660 | */ |
|
661 | private function filterQueryAndFragment($str) |
|
662 | { |
|
663 | if (!is_string($str)) { |
|
664 | throw new \InvalidArgumentException('Query and fragment must be a string'); |
|
665 | } |
|
666 | ||
667 | return preg_replace_callback( |
|
668 | '/(?:[^' . self::$charUnreserved . self::$charSubDelims . '%:@\/\?]++|%(?![A-Fa-f0-9]{2}))/', |
|
669 | [$this, 'rawurlencodeMatchZero'], |
|
670 | $str |
|
671 | ); |
|
672 | } |
|
673 | ||
674 | private function rawurlencodeMatchZero(array $match) |
|
675 | { |