setLog($this->log); $attempts = []; $allowed = []; $playerName = []; foreach ($this->log as $entry) { $text = (string) $entry; if (preg_match(UserPattern::PLAYER_EVENT, $text, $m) !== 1) { continue; } $steamId = $m['steamid']; $playerName[$steamId] = $m['player']; if (str_starts_with($m['event'], 'attempting to join')) { $attempts[$steamId] = ($attempts[$steamId] ?? 0) + 1; } elseif (str_starts_with($m['event'], 'allowed to join')) { $allowed[$steamId] = ($allowed[$steamId] ?? 0) + 1; } } foreach ($attempts as $steamId => $attemptCount) { $allowedCount = $allowed[$steamId] ?? 0; $unmatched = $attemptCount - $allowedCount; if ($unmatched <= 0) { continue; } $analysis->addInsight((new ConnectionFailureProblem()) ->setSteamId($steamId) ->setPlayer($playerName[$steamId] ?? '') ->setUnmatchedAttempts($unmatched)); } return $analysis; } }