{
"tool_response": {
"type": "text",
"file": {
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Infrastructure\/CodeAnalysis\/CodeQualityChecker.php",
"content": "<?php\n\ndeclare(strict_types=1);\n\nnamespace Infrastructure\\CodeAnalysis;\n\n\/\/ @responsibility: Code-Hygiene-Analyse (Score 0-100, normalisiert, gewichtet)\n\nfinal class CodeQualityChecker\n{\n \/** @var array<string, string> Regex patterns for secret detection *\/\n private const SECRET_PATTERNS = [\n 'password' => '\/[\"\\'](?:password|passwd|pwd)[\"\\']\\\\s*[=:]\\\\s*[\"\\'][^\"\\']{3,}[\"\\']\/i',\n 'api_key' => '\/[\"\\'](?:api[_-]?key|apikey|secret[_-]?key)[\"\\']\\\\s*[=:]\\\\s*[\"\\'][^\"\\']{8,}[\"\\']\/i',\n 'token' => '\/[\"\\'](?:token|auth[_-]?token|access[_-]?token)[\"\\']\\\\s*[=:]\\\\s*[\"\\'][^\"\\']{8,}[\"\\']\/i',\n 'url_with_creds' => '\/https?:\\\\\/\\\\\/[^\\\\s:\\\\\/]+:[^\\\\s@]+@\/i',\n ];\n\n \/** @var array<string, string> Regex patterns for magic number detection *\/\n private const MAGIC_NUMBER_PATTERNS = [\n 'magic_number' => '\/(?<![\\\\w])(?:100|1000|60|24|365|3600|86400)(?![\\\\w])\/',\n ];\n\n \/** @var array<string, array{optimal: int, max: int}> Default hygiene thresholds *\/\n private const HYGIENE_DEFAULTS = [\n 'loc' => ['optimal' => 200, 'max' => 500],\n 'methods' => ['optimal' => 10, 'max' => 20],\n 'classes' => ['optimal' => 1, 'max' => 3],\n 'dependencies' => ['optimal' => 5, 'max' => 15],\n 'secrets' => ['optimal' => 0, 'max' => 1],\n 'magic_numbers' => ['optimal' => 0, 'max' => 10],\n ];\n\n \/** @var array<string, array<string, array{optimal: int, max: int}>> File type specific modifiers *\/\n private const FILE_TYPE_MODIFIERS = [\n 'Controller' => [\n 'loc' => ['optimal' => 300, 'max' => 500],\n 'methods' => ['optimal' => 15, 'max' => 25],\n ],\n 'Entity' => [\n 'loc' => ['optimal' => 100, 'max' => 300],\n 'methods' => ['optimal' => 20, 'max' => 30],\n ],\n 'Repository' => [\n 'loc' => ['optimal' => 250, 'max' => 400],\n 'dependencies' => ['optimal' => 3, 'max' => 8],\n ],\n 'Service' => [\n 'loc' => ['optimal' => 150, 'max' => 350],\n ],",
"numLines": 50,
"startLine": 1,
"totalLines": 411
}
}
}