protected function buildBuilders($pattern, array $matches)
    {
        $result = [
            'pattern' => $pattern,
            'segments' => []
        ];

        foreach ($matches as $match) {
            list($key,) = $this->splitSegment($match[3]);
            $result['pattern'] = str_replace($match[0], '{' . $key . '}', $result['pattern']);
            $result['segments']['{' . $key . '}'] = '{value}' . $match[4] . (isset($match[7]) ? $match[7] : '');
        }

        return $result;
    }