code-show.php
- Pfad:
src/View/docs/code-show.php - Namespace: -
- Zeilen: 180 | Größe: 8,068 Bytes
- Geändert: 2025-12-25 16:28:41 | Gescannt: 2025-12-31 10:22:15
Code Hygiene Score: 100
- Dependencies: 100 (25%)
- LOC: 100 (20%)
- Methods: 100 (20%)
- Secrets: 100 (15%)
- Classes: 100 (10%)
- Magic Numbers: 100 (10%)
Keine Issues gefunden.
Versionen 18
-
v18
2025-12-25 16:28 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v17
2025-12-25 16:28 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v16
2025-12-25 16:28 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v15
2025-12-25 16:28 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v14
2025-12-25 16:26 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v13
2025-12-25 16:26 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v12
2025-12-25 16:17 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v11
2025-12-25 16:17 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v10
2025-12-25 16:17 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v9
2025-12-23 22:15 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v8
2025-12-23 22:08 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v7
2025-12-23 22:06 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v6
2025-12-23 22:00 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v5
2025-12-23 21:55 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Write-Operation -
v4
2025-12-23 21:51 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v3
2025-12-23 15:36 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v2
2025-12-23 15:28 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v1
2025-12-23 15:21 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation
Code
<?php
declare(strict_types=1);
// @responsibility: View für Code-Analyse-Detailansicht (KISS)
ob_start();
$shortPath = str_replace('/var/www/dev.campus.systemische-tools.de/', '', $file['file_path']);
$hygieneScore = $file['hygiene_score'] ?? null;
$factorScores = json_decode($file['factor_scores'] ?? '{}', true) ?: [];
$qualityIssues = json_decode($file['issues_json'] ?? '[]', true) ?: [];
?>
<nav class="breadcrumb">
<a href="/docs/code-hygiene">Code Hygiene</a> »
<span><?= htmlspecialchars($file['file_name']) ?></span>
</nav>
<h1><?= htmlspecialchars($file['file_name']) ?></h1>
<?php if ($file['parse_error']): ?>
<div class="alert alert--danger" style="margin-bottom: 1rem;">
<strong>Parse-Fehler:</strong> <?= htmlspecialchars($file['parse_error']) ?>
</div>
<?php endif; ?>
<ul style="list-style: none; padding: 0; margin: 0 0 1.5rem 0; font-size: 0.9rem;">
<li><strong>Pfad:</strong> <code><?= htmlspecialchars($shortPath) ?></code></li>
<li><strong>Namespace:</strong> <?= htmlspecialchars($file['namespace'] ?? '-') ?></li>
<li><strong>Zeilen:</strong> <?= number_format($file['line_count']) ?> | <strong>Größe:</strong> <?= number_format($file['file_size']) ?> Bytes</li>
<li><strong>Geändert:</strong> <?= htmlspecialchars($file['modified_at']) ?> | <strong>Gescannt:</strong> <?= htmlspecialchars($file['scanned_at']) ?></li>
</ul>
<?php if ($hygieneScore !== null): ?>
<h2>Code Hygiene Score: <?= $hygieneScore ?></h2>
<ul style="list-style: none; padding: 0; margin: 0 0 1.5rem 0; font-size: 0.9rem;">
<li><strong>Dependencies:</strong> <?= $factorScores['dependencies'] ?? 0 ?> <small>(25%)</small></li>
<li><strong>LOC:</strong> <?= $factorScores['loc'] ?? 0 ?> <small>(20%)</small></li>
<li><strong>Methods:</strong> <?= $factorScores['methods'] ?? 0 ?> <small>(20%)</small></li>
<li><strong>Secrets:</strong> <?= $factorScores['secrets'] ?? 0 ?> <small>(15%)</small></li>
<li><strong>Classes:</strong> <?= $factorScores['classes'] ?? 0 ?> <small>(10%)</small></li>
<li><strong>Magic Numbers:</strong> <?= $factorScores['magic_numbers'] ?? 0 ?> <small>(10%)</small></li>
</ul>
<?php if (!empty($qualityIssues)): ?>
<h3>Issues <span class="badge badge--danger"><?= count($qualityIssues) ?></span></h3>
<table class="data-table">
<thead>
<tr>
<th>Zeile</th>
<th>Typ</th>
<th>Beschreibung</th>
</tr>
</thead>
<tbody>
<?php foreach ($qualityIssues as $issue): ?>
<tr>
<td><?= $issue['line'] ?? '-' ?></td>
<td><span class="badge badge--warning"><?= htmlspecialchars($issue['type'] ?? '') ?></span></td>
<td><?= htmlspecialchars($issue['message'] ?? '') ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php else: ?>
<p style="color: var(--color-success);">Keine Issues gefunden.</p>
<?php endif; ?>
<?php endif; ?>
<?php if ($hygieneScore === null): ?>
<div class="alert alert--warning" style="margin-bottom: 1rem;">
<strong>Hinweis:</strong> Keine Hygiene-Daten vorhanden. Bitte "Jetzt scannen" auf der Code-Übersicht ausführen.
</div>
<?php endif; ?>
<?php
$totalDeps = count($uses) + ($extendsClass ? 1 : 0) + count($implements) + count($traits) + count($constructorDeps);
?>
<?php if ($totalDeps > 0): ?>
<h2>Dependencies <span class="badge badge--info"><?= $totalDeps ?></span></h2>
<ul style="list-style: none; padding: 0; margin: 0 0 1.5rem 0; font-size: 0.9rem; font-family: monospace;">
<?php if ($extendsClass): ?>
<li><span class="badge badge--warning">extends</span> <?= htmlspecialchars($extendsClass) ?></li>
<?php endif; ?>
<?php foreach ($implements as $iface): ?>
<li><span class="badge badge--info">implements</span> <?= htmlspecialchars($iface) ?></li>
<?php endforeach; ?>
<?php foreach ($traits as $trait): ?>
<li><span class="badge badge--success">trait</span> <?= htmlspecialchars($trait) ?></li>
<?php endforeach; ?>
<?php foreach ($constructorDeps as $dep): ?>
<li><span class="badge badge--primary">constructor</span> <?= htmlspecialchars($dep) ?></li>
<?php endforeach; ?>
<?php foreach ($uses as $use): ?>
<li><span class="badge">use</span> <?= htmlspecialchars($use) ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<?php if (!empty($classes)): ?>
<h2>Klassen <span class="badge badge--info"><?= count($classes) ?></span></h2>
<ul style="list-style: none; padding: 0; margin: 0 0 1.5rem 0; font-size: 0.9rem;">
<?php foreach ($classes as $class): ?>
<li>
<code><?= htmlspecialchars($class['name']) ?></code>
<span class="badge badge--<?= $class['type'] === 'interface' ? 'warning' : ($class['type'] === 'trait' ? 'info' : 'default') ?>"><?= $class['type'] ?></span>
<small style="color: var(--text-muted);">Zeile <?= $class['line'] ?></small>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<?php if (!empty($functions)): ?>
<h2>Funktionen <span class="badge badge--success"><?= count($functions) ?></span></h2>
<ul style="list-style: none; padding: 0; margin: 0 0 1.5rem 0; font-size: 0.9rem;">
<?php foreach ($functions as $func): ?>
<li>
<code><?= htmlspecialchars($func['name']) ?>()</code>
<?php if ($func['visibility']): ?>
<span class="badge badge--<?= $func['visibility'] === 'private' ? 'danger' : ($func['visibility'] === 'protected' ? 'warning' : 'success') ?>"><?= $func['visibility'] ?></span>
<?php endif; ?>
<small style="color: var(--text-muted);">Zeile <?= $func['line'] ?></small>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<?php if (!empty($dependents)): ?>
<h2>Verwendet von <span class="badge badge--warning"><?= count($dependents) ?></span></h2>
<ul style="list-style: none; padding: 0; margin: 0 0 1.5rem 0; font-size: 0.9rem;">
<?php foreach ($dependents as $dep): ?>
<li>
<a href="/docs/code-hygiene/<?= $dep['id'] ?>"><?= htmlspecialchars($dep['file_name']) ?></a>
<span class="badge badge--<?= match($dep['dependency_type']) {
'extends' => 'warning',
'implements' => 'info',
'constructor' => 'primary',
default => 'default'
} ?>"><?= $dep['dependency_type'] ?></span>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<?php if (!empty($backupHistory)): ?>
<h2>Versionen <span class="badge badge--secondary"><?= count($backupHistory) ?></span></h2>
<ul style="list-style: none; padding: 0; margin: 0 0 1.5rem 0; font-size: 0.9rem;">
<?php foreach ($backupHistory as $backup): ?>
<li style="margin-bottom: 0.5rem;">
<a href="/backup-restore/<?= $backup['id'] ?>">v<?= $backup['version'] ?></a>
<small style="color: var(--text-muted);">
<?= htmlspecialchars(substr($backup['changed_at'], 0, 16)) ?>
| <?= htmlspecialchars($backup['changed_by']) ?>
| <?= htmlspecialchars($backup['change_type']) ?>
</small>
<?php if ($backup['reason']): ?>
<br><small style="color: var(--text-muted); margin-left: 3rem;"><?= htmlspecialchars(substr($backup['reason'], 0, 80)) ?><?= strlen($backup['reason']) > 80 ? '...' : '' ?></small>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<h2>Code</h2>
<?php if (!empty($file['file_content'])): ?>
<pre style="background: #1e1e1e; color: #d4d4d4; padding: 1rem; border-radius: 8px; overflow-x: auto; font-size: 0.85rem; line-height: 1.5;"><code><?= htmlspecialchars($file['file_content']) ?></code></pre>
<?php else: ?>
<p style="color: var(--text-muted);">Kein Inhalt verfügbar - Scan erforderlich.</p>
<?php endif; ?>
<div style="margin-top: 2rem;">
<a href="/docs/code-hygiene" class="btn btn--secondary">← Übersicht</a>
<?php if (!empty($classes)): ?>
<a href="/docs/code-hygiene/<?= $file['id'] ?>/graph" class="btn btn--primary">Graph</a>
<?php endif; ?>
</div>
<?php $content = ob_get_clean(); ?>
<?php require VIEW_PATH . '/layout.php'; ?>