Backup #941

ID941
Dateipfad/var/www/dev.campus.systemische-tools.de/src/View/docs/code-show.php
Version5
Typ modified
Größe14.2 KB
Hash8d94cc3fab08a8a8a199e8ba09abd8c4a4b1ddda804a36e3e87e8fe51ca59532
Datum2025-12-23 21:55:23
Geändert vonclaude-code-hook
GrundClaude Code Pre-Hook Backup vor Write-Operation
Datei existiert Ja

Dateiinhalt

<?php

declare(strict_types=1);

// @responsibility: View für Code-Analyse-Detailansicht

ob_start();
$shortPath = str_replace('/var/www/dev.campus.systemische-tools.de/', '', $file['file_path']);
?>

<nav class="breadcrumb">
    <a href="/docs/code">Code-Analyse</a> &raquo;
    <span><?= htmlspecialchars($file['file_name']) ?></span>
</nav>

<h1><?= htmlspecialchars($file['file_name']) ?></h1>

<div class="file-meta" style="margin-bottom: 1.5rem; padding: 1rem; background: var(--bg-secondary); border-radius: 8px;">
    <dl style="display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin: 0;">
        <div>
            <dt style="font-size: 0.875rem; color: var(--text-muted);">Pfad</dt>
            <dd style="margin: 0; font-family: monospace; font-size: 0.875rem;"><?= htmlspecialchars($shortPath) ?></dd>
        </div>
        <div>
            <dt style="font-size: 0.875rem; color: var(--text-muted);">Namespace</dt>
            <dd style="margin: 0; font-family: monospace;"><?= htmlspecialchars($file['namespace'] ?? '-') ?></dd>
        </div>
        <div>
            <dt style="font-size: 0.875rem; color: var(--text-muted);">Zeilen</dt>
            <dd style="margin: 0;"><?= number_format($file['line_count']) ?></dd>
        </div>
        <div>
            <dt style="font-size: 0.875rem; color: var(--text-muted);">Dateigröße</dt>
            <dd style="margin: 0;"><?= number_format($file['file_size']) ?> Bytes</dd>
        </div>
        <div>
            <dt style="font-size: 0.875rem; color: var(--text-muted);">Geändert</dt>
            <dd style="margin: 0;"><?= htmlspecialchars($file['modified_at']) ?></dd>
        </div>
        <div>
            <dt style="font-size: 0.875rem; color: var(--text-muted);">Gescannt</dt>
            <dd style="margin: 0;"><?= htmlspecialchars($file['scanned_at']) ?></dd>
        </div>
    </dl>
</div>

<?php if ($file['parse_error']): ?>
<div class="alert alert--danger" style="margin-bottom: 1.5rem;">
    <strong>Parse-Fehler:</strong> <?= htmlspecialchars($file['parse_error']) ?>
</div>
<?php endif; ?>

<?php
// Quality Data
$qualityGrade = $file['quality_grade'] ?? null;
$qualityIssues = json_decode($file['issues_json'] ?? '[]', true) ?: [];
$gradeClass = match ($qualityGrade) {
    'A' => 'badge--success',
    'B' => 'badge--info',
    'C' => 'badge--warning',
    'D', 'F' => 'badge--danger',
    default => 'badge--secondary',
};
?>
<?php if ($qualityGrade): ?>
<div style="margin-bottom: 1.5rem;">
    <h2>Code Quality <span class="badge <?= $gradeClass ?>" style="font-size: 1.25rem;"><?= $qualityGrade ?></span></h2>

    <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 1rem; margin-bottom: 1rem;">
        <div style="padding: 0.75rem; background: var(--bg-secondary); border-radius: 6px; text-align: center;">
            <div style="font-size: 1.5rem; font-weight: bold; color: var(--color-primary);"><?= $file['complexity_score'] ?? 0 ?></div>
            <div style="font-size: 0.75rem; color: var(--text-muted);">Complexity Score</div>
        </div>
        <div style="padding: 0.75rem; background: var(--bg-secondary); border-radius: 6px; text-align: center;">
            <div style="font-size: 1.5rem; font-weight: bold; color: var(--color-info);"><?= $file['loc_score'] ?? 0 ?></div>
            <div style="font-size: 0.75rem; color: var(--text-muted);">LOC Score</div>
        </div>
        <div style="padding: 0.75rem; background: var(--bg-secondary); border-radius: 6px; text-align: center;">
            <div style="font-size: 1.5rem; font-weight: bold; color: var(--color-success);"><?= $file['dependency_score'] ?? 0 ?></div>
            <div style="font-size: 0.75rem; color: var(--text-muted);">Dependency Score</div>
        </div>
        <div style="padding: 0.75rem; background: var(--bg-secondary); border-radius: 6px; text-align: center;">
            <div style="font-size: 1.5rem; font-weight: bold; color: var(--color-warning);"><?= $file['hardcoded_count'] ?? 0 ?></div>
            <div style="font-size: 0.75rem; color: var(--text-muted);">Hardcoded</div>
        </div>
    </div>

    <?php if (!empty($qualityIssues)): ?>
    <div style="background: var(--bg-secondary); border-radius: 8px; padding: 1rem;">
        <h3 style="margin-top: 0; font-size: 1rem;">
            Issues <span class="badge badge--danger"><?= count($qualityIssues) ?></span>
        </h3>
        <table class="data-table" style="margin: 0;">
            <thead>
                <tr>
                    <th style="width: 80px;">Zeile</th>
                    <th style="width: 120px;">Typ</th>
                    <th style="width: 100px;">Severity</th>
                    <th>Beschreibung</th>
                </tr>
            </thead>
            <tbody>
                <?php foreach ($qualityIssues as $issue): ?>
                <tr>
                    <td style="font-family: monospace;"><?= $issue['line'] ?? '-' ?></td>
                    <td>
                        <span class="badge badge--<?= match($issue['type'] ?? '') {
                            'hardcoded' => 'warning',
                            'complexity' => 'info',
                            'srp' => 'primary',
                            'coupling' => 'danger',
                            default => 'secondary'
                        } ?>">
                            <?= htmlspecialchars($issue['type'] ?? 'unknown') ?>
                        </span>
                    </td>
                    <td>
                        <span class="badge badge--<?= match($issue['severity'] ?? '') {
                            'error' => 'danger',
                            'warning' => 'warning',
                            'info' => 'info',
                            default => 'secondary'
                        } ?>">
                            <?= htmlspecialchars($issue['severity'] ?? 'info') ?>
                        </span>
                    </td>
                    <td style="font-size: 0.875rem;"><?= htmlspecialchars($issue['message'] ?? '') ?></td>
                </tr>
                <?php endforeach; ?>
            </tbody>
        </table>
    </div>
    <?php else: ?>
    <div style="padding: 1rem; background: var(--bg-success); border-radius: 8px; color: var(--color-success);">
        Keine Issues gefunden - Code ist sauber!
    </div>
    <?php endif; ?>
</div>
<?php endif; ?>

<?php
$totalDeps = count($uses) + ($extendsClass ? 1 : 0) + count($implements) + count($traits) + count($constructorDeps);
?>
<?php if ($totalDeps > 0): ?>
<div style="margin-bottom: 1.5rem;">
    <h2>Dependencies <span class="badge badge--info"><?= $totalDeps ?></span></h2>
    <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1rem;">
        <?php if ($extendsClass): ?>
        <div style="padding: 0.75rem; background: var(--bg-secondary); border-radius: 6px; border-left: 3px solid var(--color-warning);">
            <strong style="font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase;">Extends</strong>
            <div style="font-family: monospace; font-size: 0.875rem; margin-top: 0.25rem;"><?= htmlspecialchars($extendsClass) ?></div>
        </div>
        <?php endif; ?>

        <?php if (!empty($implements)): ?>
        <div style="padding: 0.75rem; background: var(--bg-secondary); border-radius: 6px; border-left: 3px solid var(--color-info);">
            <strong style="font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase;">Implements (<?= count($implements) ?>)</strong>
            <div style="font-family: monospace; font-size: 0.875rem; margin-top: 0.25rem;">
                <?php foreach ($implements as $iface): ?>
                <div><?= htmlspecialchars($iface) ?></div>
                <?php endforeach; ?>
            </div>
        </div>
        <?php endif; ?>

        <?php if (!empty($traits)): ?>
        <div style="padding: 0.75rem; background: var(--bg-secondary); border-radius: 6px; border-left: 3px solid var(--color-success);">
            <strong style="font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase;">Traits (<?= count($traits) ?>)</strong>
            <div style="font-family: monospace; font-size: 0.875rem; margin-top: 0.25rem;">
                <?php foreach ($traits as $trait): ?>
                <div><?= htmlspecialchars($trait) ?></div>
                <?php endforeach; ?>
            </div>
        </div>
        <?php endif; ?>

        <?php if (!empty($constructorDeps)): ?>
        <div style="padding: 0.75rem; background: var(--bg-secondary); border-radius: 6px; border-left: 3px solid var(--color-primary);">
            <strong style="font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase;">Constructor DI (<?= count($constructorDeps) ?>)</strong>
            <div style="font-family: monospace; font-size: 0.875rem; margin-top: 0.25rem;">
                <?php foreach ($constructorDeps as $dep): ?>
                <div><?= htmlspecialchars($dep) ?></div>
                <?php endforeach; ?>
            </div>
        </div>
        <?php endif; ?>
    </div>

    <?php if (!empty($uses)): ?>
    <details style="margin-top: 1rem;">
        <summary style="cursor: pointer; padding: 0.5rem; background: var(--bg-secondary); border-radius: 6px;">
            <strong>Use-Statements (<?= count($uses) ?>)</strong>
        </summary>
        <div style="padding: 0.75rem; background: var(--bg-tertiary); border-radius: 0 0 6px 6px; font-family: monospace; font-size: 0.875rem;">
            <?php foreach ($uses as $use): ?>
            <div style="padding: 0.125rem 0;"><?= htmlspecialchars($use) ?></div>
            <?php endforeach; ?>
        </div>
    </details>
    <?php endif; ?>
</div>
<?php endif; ?>

<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.5rem;">
    <div>
        <h2>Klassen <span class="badge badge--info"><?= count($classes) ?></span></h2>
        <?php if (empty($classes)): ?>
        <p style="color: var(--text-muted);">Keine Klassen gefunden.</p>
        <?php else: ?>
        <table class="data-table">
            <thead>
                <tr>
                    <th>Name</th>
                    <th>Typ</th>
                    <th style="text-align: right;">Zeile</th>
                </tr>
            </thead>
            <tbody>
                <?php foreach ($classes as $class): ?>
                <tr>
                    <td><code><?= htmlspecialchars($class['name']) ?></code></td>
                    <td>
                        <span class="badge badge--<?= $class['type'] === 'interface' ? 'warning' : ($class['type'] === 'trait' ? 'info' : 'default') ?>">
                            <?= htmlspecialchars($class['type']) ?>
                        </span>
                    </td>
                    <td style="text-align: right;"><?= $class['line'] ?></td>
                </tr>
                <?php endforeach; ?>
            </tbody>
        </table>
        <?php endif; ?>
    </div>

    <div>
        <h2>Funktionen <span class="badge badge--success"><?= count($functions) ?></span></h2>
        <?php if (empty($functions)): ?>
        <p style="color: var(--text-muted);">Keine Funktionen gefunden.</p>
        <?php else: ?>
        <table class="data-table">
            <thead>
                <tr>
                    <th>Name</th>
                    <th>Sichtbarkeit</th>
                    <th style="text-align: right;">Zeile</th>
                </tr>
            </thead>
            <tbody>
                <?php foreach ($functions as $func): ?>
                <tr>
                    <td><code><?= htmlspecialchars($func['name']) ?></code></td>
                    <td>
                        <?php if ($func['visibility']): ?>
                        <span class="badge badge--<?= $func['visibility'] === 'private' ? 'danger' : ($func['visibility'] === 'protected' ? 'warning' : 'success') ?>">
                            <?= htmlspecialchars($func['visibility']) ?>
                        </span>
                        <?php else: ?>
                        <span class="badge">global</span>
                        <?php endif; ?>
                    </td>
                    <td style="text-align: right;"><?= $func['line'] ?></td>
                </tr>
                <?php endforeach; ?>
            </tbody>
        </table>
        <?php endif; ?>
    </div>
</div>

<?php if (!empty($dependents)): ?>
<div style="margin-top: 1.5rem;">
    <h2>Verwendet von <span class="badge badge--warning"><?= count($dependents) ?></span></h2>
    <p style="font-size: 0.875rem; color: var(--text-muted); margin-bottom: 1rem;">
        Diese Dateien haben eine Abhängigkeit zu dieser Klasse:
    </p>
    <table class="data-table">
        <thead>
            <tr>
                <th>Datei</th>
                <th>Namespace</th>
                <th>Typ</th>
            </tr>
        </thead>
        <tbody>
            <?php foreach ($dependents as $dep): ?>
            <tr>
                <td>
                    <a href="/docs/code/<?= $dep['id'] ?>">
                        <?= htmlspecialchars($dep['file_name']) ?>
                    </a>
                </td>
                <td style="font-family: monospace; font-size: 0.875rem;">
                    <?= htmlspecialchars($dep['namespace'] ?? '-') ?>
                </td>
                <td>
                    <span class="badge badge--<?= match($dep['dependency_type']) {
                        'extends' => 'warning',
                        'implements' => 'info',
                        'constructor' => 'primary',
                        'trait' => 'success',
                        default => 'default'
                    } ?>">
                        <?= htmlspecialchars($dep['dependency_type']) ?>
                    </span>
                </td>
            </tr>
            <?php endforeach; ?>
        </tbody>
    </table>
</div>
<?php endif; ?>

<div style="margin-top: 2rem; display: flex; gap: 1rem;">
    <a href="/docs/code" class="btn btn--secondary">&larr; Zurück zur Übersicht</a>
    <?php if (!empty($classes)): ?>
    <a href="/docs/code/<?= $file['id'] ?>/graph" class="btn btn--primary">Dependency Graph</a>
    <?php endif; ?>
</div>

<?php $content = ob_get_clean(); ?>
<?php require VIEW_PATH . '/layout.php'; ?>

Vollständig herunterladen

Aktionen

Herunterladen

Andere Versionen dieser Datei

ID Version Typ Größe Datum
1348 18 modified 7.9 KB 2025-12-25 16:28
1347 17 modified 7.9 KB 2025-12-25 16:28
1346 16 modified 7.9 KB 2025-12-25 16:28
1345 15 modified 7.8 KB 2025-12-25 16:28
1341 14 modified 7.9 KB 2025-12-25 16:26
1340 13 modified 8.2 KB 2025-12-25 16:26
1322 12 modified 8.0 KB 2025-12-25 16:17
1321 11 modified 7.7 KB 2025-12-25 16:17
1320 10 modified 7.5 KB 2025-12-25 16:17
954 9 modified 7.5 KB 2025-12-23 22:15
953 8 modified 7.6 KB 2025-12-23 22:08
948 7 modified 7.4 KB 2025-12-23 22:06
945 6 modified 6.2 KB 2025-12-23 22:00
941 5 modified 14.2 KB 2025-12-23 21:55
940 4 modified 9.9 KB 2025-12-23 21:51
890 3 modified 9.8 KB 2025-12-23 15:36
888 2 modified 8.2 KB 2025-12-23 15:28
883 1 modified 4.9 KB 2025-12-23 15:21

← Zurück zur Übersicht