<?php

declare(strict_types=1);

final class MicFormSpamCounter
{
    /** @var array<string, int> */
    private array $counts = [];

    public function increment(string $formId): void
    {
        $formId = trim($formId);
        $this->counts[$formId] = ($this->counts[$formId] ?? 0) + 1;
    }

    public function count(string $formId): int
    {
        return (int) ($this->counts[trim($formId)] ?? 0);
    }
}
