protected function buildPathExpressions($path, $store = false) {
        $segments = $this->routeParser->parse($path);
        $expressions = [];
        foreach ($segments as $segmentGroup) {
            $expression = '';
            $params = [];
            $staticPart = '/';
            $staticPartEnded = false;
            foreach ($segmentGroup as $segment) {
                if (is_string($segment)) {
                    $expression .= $segment;
                    if (!$staticPartEnded) {
                        $staticPart .= $segment;
                    }
                } elseif (is_array($segment)) {
                    $staticPartEnded = true;
                    $expression .= '{' . $segment[0] . '}';
                    $params[] = $segment[0];
                }
            }
            $staticPart = '/' . trim($staticPart, '/');
            if ($store && !empty($params)) {
                $row = [
                    'exp' => $expression,
                    'params' => $params,
                ];
                $this->_routePaths[$staticPart] = isset($this->_routePaths[$staticPart]) ? $this->_routePaths[$staticPart] : [];
                $this->_routePaths[$staticPart][] = $row;
            }
            $expressions[$expression] = [
                'expression' => $expression,
                'prefix' => $staticPart,
                'params' => $params,
            ];
        }

        return $expressions;
    }
protected function buildPathExpressions($path, $store = false) {
        $segments = $this->routeParser->parse($path);
        $expressions = [];
        foreach ($segments as $segmentGroup) {
            $expression = '';
            $params = [];
            $staticPart = '/';
            $staticPartEnded = false;
            foreach ($segmentGroup as $segment) {
                if (is_string($segment)) {
                    $expression .= $segment;
                    if (!$staticPartEnded) {
                        $staticPart .= $segment;
                    }
                } elseif (is_array($segment)) {
                    $staticPartEnded = true;
                    $expression .= '{' . $segment[0] . '}';
                    $params[] = $segment[0];
                }
            }
            $staticPart = '/' . trim($staticPart, '/');
            if ($store && !empty($params)) {
                $row = [
                    'exp' => $expression,
                    'params' => $params,
                ];
                $this->_routePaths[$staticPart] = isset($this->_routePaths[$staticPart]) ? $this->_routePaths[$staticPart] : [];
                $this->_routePaths[$staticPart][] = $row;
            }
            $expressions[$expression] = [
                'expression' => $expression,
                'prefix' => $staticPart,
                'params' => $params,
            ];
        }

        return $expressions;
    }
protected function buildPathExpressions ( $ path , $ store = false ) { $ segments = $ this -> routeParser -> parse ( $ path ) ; $ expressions = [ ] ; foreach ( $ segments as $ segmentGroup ) { $ expression = '' ; $ params = [ ] ; $ staticPart = '/' ; $ staticPartEnded = false ; foreach ( $ segmentGroup as $ segment ) { if ( is_string ( $ segment ) ) { $ expression .= $ segment ; if ( ! $ staticPartEnded ) { $ staticPart .= $ segment ; } } elseif ( is_array ( $ segment ) ) { $ staticPartEnded = true ; $ expression .= '{' . $ segment [ 0 ] . '}' ; $ params [ ] = $ segment [ 0 ] ; } } $ staticPart = '/' . trim ( $ staticPart , '/' ) ; if ( $ store && ! empty ( $ params ) ) { $ row = [ 'exp' => $ expression , 'params' => $ params , ] ; $ this -> _routePaths [ $ staticPart ] = isset ( $ this -> _routePaths [ $ staticPart ] ) ? $ this -> _routePaths [ $ staticPart ] : [ ] ; $ this -> _routePaths [ $ staticPart ] [ ] = $ row ; } $ expressions [ $ expression ] = [ 'expression' => $ expression , 'prefix' => $ staticPart , 'params' => $ params , ] ; } return $ expressions ; }
Build path expression from router path
@param string $path
@param bool $store
@return array
Build path expression from router path