getRoutePattern() public method

Get this routes route pattern
public getRoutePattern ( ) : string
return string $route_pattern
示例#1
0
文件: Matcher.php 项目: jdrich/drest
 /**
  * Get the regex pattern to match the request path
  * @param $basePath
  * @return string
  */
 protected function getMatchRegexPattern($basePath)
 {
     // Convert URL params into regex patterns, construct a regex for this route, init params
     $routePattern = is_null($basePath) ? (string) $this->routeMetaData->getRoutePattern() : '/' . $basePath . '/' . ltrim((string) $this->routeMetaData->getRoutePattern(), '/');
     $patternAsRegex = preg_replace_callback('#:([\\w]+)\\+?#', [$this, 'matchesCallback'], str_replace(')', ')?', $routePattern));
     if (substr($this->routeMetaData->getRoutePattern(), -1) === '/') {
         $patternAsRegex .= '?';
     }
     return $patternAsRegex;
 }