public function matchPatterns(array $segments, array & $values): bool
    {
        $parsed = [];

        foreach ($this->patterns as $i => $pattern) {
            if (!preg_match($pattern, $segments[$i], $match)) {
                return false;
            }

            if ($match[0] !== $segments[$i]) {
                return false;
            }

            $parsed += array_intersect_key($match, array_flip($this->parameterNames));
        }

        $values = $parsed;

        return true;
    }