/**
* @throws RecursionLimitReachedException
*/
private function incrementCounter(int $counter, int $limit, string $parameterKey) : int
{
if ($counter >= $limit) {
throw RecursionLimitReachedExceptionFactory::create($limit, $parameterKey);
}
return ++$counter;
}