private function parseDynamicGroup($group)
    {
        $regex = $group['regex'];
        $parts = explode('|', $regex);
        $data = array();
        foreach ($group['routeMap'] as $matchIndex => $routeData) {
            if (!is_array($routeData[0]) || !isset($routeData[0]['name']) || !isset($parts[$matchIndex - 1])) {
                continue;
            }

            $parameters = $routeData[1];
            $path = $parts[$matchIndex - 1];

            foreach ($parameters as $parameter) {
                $path = $this->replaceOnce('([^/]+)', '{'.$parameter.'}', $path);
            }

            $path = rtrim($path, '()$~');

            $data[$routeData[0]['name']] = array(
                'path' => $path,
                'params' => $parameters,
            );
        }

        return $data;
    }
private function parseDynamicGroup($group)
    {
        $regex = $group['regex'];
        $parts = explode('|', $regex);
        $data = array();
        foreach ($group['routeMap'] as $matchIndex => $routeData) {
            if (!is_array($routeData[0]) || !isset($routeData[0]['name']) || !isset($parts[$matchIndex - 1])) {
                continue;
            }

            $parameters = $routeData[1];
            $path = $parts[$matchIndex - 1];

            foreach ($parameters as $parameter) {
                $path = $this->replaceOnce('([^/]+)', '{'.$parameter.'}', $path);
            }

            $path = rtrim($path, '()$~');

            $data[$routeData[0]['name']] = array(
                'path' => $path,
                'params' => $parameters,
            );
        }

        return $data;
    }
private function parseDynamicGroup ( $ group ) { $ regex = $ group [ 'regex' ] ; $ parts = explode ( '|' , $ regex ) ; $ data = array ( ) ; foreach ( $ group [ 'routeMap' ] as $ matchIndex => $ routeData ) { if ( ! is_array ( $ routeData [ 0 ] ) || ! isset ( $ routeData [ 0 ] [ 'name' ] ) || ! isset ( $ parts [ $ matchIndex - 1 ] ) ) { continue ; } $ parameters = $ routeData [ 1 ] ; $ path = $ parts [ $ matchIndex - 1 ] ; foreach ( $ parameters as $ parameter ) { $ path = $ this -> replaceOnce ( '([^/]+)' , '{' . $ parameter . '}' , $ path ) ; } $ path = rtrim ( $ path , '()$~' ) ; $ data [ $ routeData [ 0 ] [ 'name' ] ] = array ( 'path' => $ path , 'params' => $ parameters , ) ; } return $ data ; }
Parse a group of dynamic routes

@param $group
@return array
Parse a group of dynamic routes