Prado\Web\TUrlMappingPattern::getPatternMatches PHP 메소드

getPatternMatches() 공개 메소드

Uses URL pattern (or full regular expression if available) to match the given url path.
public getPatternMatches ( $request ) : array
리턴 array matched parameters, empty if no matches.
    public function getPatternMatches($request)
    {
        $matches = array();
        if (($pattern = $this->getRegularExpression()) !== '') {
            preg_match($pattern, $request->getPathInfo(), $matches);
        } else {
            preg_match($this->getParameterizedPattern(), trim($request->getPathInfo(), '/') . '/', $matches);
        }
        if ($this->getIsWildCardPattern() && isset($matches[$this->_serviceID])) {
            $matches[$this->_serviceID] = str_replace('*', $matches[$this->_serviceID], $this->_serviceParameter);
        }
        if (isset($matches['urlparams'])) {
            $params = explode('/', $matches['urlparams']);
            if ($this->_separator === '/') {
                while ($key = array_shift($params)) {
                    $matches[$key] = ($value = array_shift($params)) ? $value : '';
                }
            } else {
                array_pop($params);
                foreach ($params as $param) {
                    list($key, $value) = explode($this->_separator, $param, 2);
                    $matches[$key] = $value;
                }
            }
            unset($matches['urlparams']);
        }
        if (count($matches) > 0 && $this->_constants) {
            foreach ($this->_constants->toArray() as $key => $value) {
                $matches[$key] = $value;
            }
        }
        return $matches;
    }