Skip to content

Commit fae7c6d

Browse files
committed
Make pattern2regex public
1 parent dca5a51 commit fae7c6d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/WaterPipe/HTTP/Request/RequestUri.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public function build()
115115
if ($this->_pattern !== null && $this->_uri !== null) {
116116
$params = self::_getUriParams($this->_pattern);
117117

118-
$regex = self::_pattern2regex($this->_pattern);
118+
$regex = self::pattern2regex($this->_pattern);
119119
preg_match("#^{$regex}\$#", $this->_uri, $values);
120120
array_shift($values);
121121

@@ -147,7 +147,7 @@ public function isBuilt(): bool
147147
*/
148148
public static function isMatch(string $pattern, string $uri): bool
149149
{
150-
$pattern = self::_pattern2regex($pattern);
150+
$pattern = self::pattern2regex($pattern);
151151
return preg_match("#^{$pattern}\$#", $uri) != false;
152152
}
153153

@@ -163,7 +163,7 @@ private static function _getUriParams(string $pattern): array
163163
return array();
164164
}
165165

166-
private static function _pattern2regex(string $pattern): string
166+
public static function pattern2regex(string $pattern): string
167167
{
168168
return preg_replace(self::URI_PARAM_PATTERN, "([a-zA-Z0-9-_\.]+)", $pattern);
169169
}

0 commit comments

Comments
 (0)