$results */ public function render(array $results, string $target): string { $totalPages = count($results); $date = date('Y-m-d H:i:s'); // Calculate severity, standard counts and overall average score $criticalCount = 0; $errorCount = 0; $warningCount = 0; $infoCount = 0; $standardA = 0; $standardAA = 0; $standardAAA = 0; $pageScores = []; $totalViolations = 0; foreach ($results as $url => $violations) { $totalViolations += count($violations); $pageCrit = 0; $pageErr = 0; $pageWarn = 0; $pageInfo = 0; foreach ($violations as $v) { switch ($v->severity) { case \YakNet\AccessibilityConsole\Core\Severity::CRITICAL: $criticalCount++; $pageCrit++; break; case \YakNet\AccessibilityConsole\Core\Severity::ERROR: $errorCount++; $pageErr++; break; case \YakNet\AccessibilityConsole\Core\Severity::WARNING: $warningCount++; $pageWarn++; break; case \YakNet\AccessibilityConsole\Core\Severity::INFO: $infoCount++; $pageInfo++; break; } switch ($v->standard) { case \YakNet\AccessibilityConsole\Core\WCAGStandard::A: $standardA++; break; case \YakNet\AccessibilityConsole\Core\WCAGStandard::AA: $standardAA++; break; case \YakNet\AccessibilityConsole\Core\WCAGStandard::AAA: $standardAAA++; break; } } $deductions = ($pageCrit * 15) + ($pageErr * 10) + ($pageWarn * 4) + ($pageInfo * 1); $pageScores[$url] = max(0, min(100, 100 - $deductions)); } $averageScore = $totalPages > 0 ? (int)round(array_sum($pageScores) / $totalPages) : 100; // Generate Page Selector options $pageOptions = ""; foreach ($results as $url => $violations) { $escapedUrl = htmlspecialchars($url, ENT_QUOTES, 'UTF-8'); $vCount = count($violations); $pageOptions .= ""; } $cards = ''; $cardIndex = 0; foreach ($results as $url => $violations) { $escapedUrl = htmlspecialchars($url, ENT_QUOTES, 'UTF-8'); foreach ($violations as $v) { $severityClass = strtolower($v->severity->value); $standardVal = $v->standard->value; $aiSuggestion = $v->fixSuggestion; $explanation = ''; $fixedCode = ''; if ($aiSuggestion && str_contains($aiSuggestion, 'FIX:')) { preg_match('/EXPLANATION:(.*)FIX:(.*)/s', $aiSuggestion, $matches); $explanation = trim($matches[1] ?? ''); $fixedCode = trim($matches[2] ?? ''); $fixedCode = preg_replace('/^```html\s*|\s*```$/i', '', $fixedCode) ?? ''; } else { $fixedCode = $aiSuggestion; } $escapedSnippet = htmlspecialchars($v->htmlSnippet, ENT_QUOTES, 'UTF-8'); $escapedFixed = $fixedCode ? htmlspecialchars($fixedCode, ENT_QUOTES, 'UTF-8') : ''; $escapedExplanation = $explanation ? htmlspecialchars($explanation, ENT_QUOTES, 'UTF-8') : ''; $locationStr = $v->location ? htmlspecialchars($v->location['file'] . ':' . (string)$v->location['line'], ENT_QUOTES, 'UTF-8') : 'N/A'; $escapedRuleId = htmlspecialchars($v->ruleId, ENT_QUOTES, 'UTF-8'); $escapedMessage = htmlspecialchars($v->message, ENT_QUOTES, 'UTF-8'); $hasAiFix = !empty($fixedCode); $aiTabButton = $hasAiFix ? "" : ""; $aiTabPanel = $hasAiFix ? "
{$escapedFixed}
{$escapedSnippet}
Web Standartları ve WCAG Uyum Analiz Raporu
Tarama yapılan sayfaların ortalama puanı.