<commit_before><?php declare(strict_types=1);

namespace Symplify\ChangelogLinker\Analyzer;

use Nette\Utils\Strings;
use Symplify\ChangelogLinker\Regex\RegexPattern;

final class IdsAnalyzer
{
    public function getHighestIdInChangelog(string $filePath): int
    {
        $changelogContent = file_get_contents($filePath);

        $matches = Strings::matchAll($changelogContent, '#- \[?(\#(?<id>[0-9]+))\]?#');<commit_msg>extract PR_REFERENCE_IN_LIST constant<commit_after><?php declare(strict_types=1);

namespace Symplify\ChangelogLinker\Analyzer;

use Nette\Utils\Strings;

final class IdsAnalyzer
{
    /**
     * @var string
     *
     * Covers cases like:
     * - #5 Add this => 5
     * - [#10] Change tha => 10
     */
    private const PR_REFERENCE_IN_LIST = '#- \[?(\#(?<id>[0-9]+))\]?#';

    public function getHighestIdInChangelog(string $filePath): int
    {
        $changelogContent = file_get_contents($filePath);

        $matches = Strings::matchAll($changelogContent, self::PR_REFERENCE_IN_LIST);
{'fraction_non_alphanumeric': 0.14691478942213515, 'fraction_numerical': 0.011753183153770812, 'mean_word_length': 4.11, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '251108', 'n_tokens_mistral': 367, 'n_tokens_neox': 351, 'n_words': 58}