GetCodeAnalysisUseCase.php
- Pfad:
src/UseCases/CodeAnalysis/GetCodeAnalysisUseCase.php - Namespace: UseCases\CodeAnalysis
- Zeilen: 92 | Größe: 2,596 Bytes
- Geändert: 2025-12-27 23:22:38 | 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.
Dependencies 7
- constructor Domain\Repository\FileAnalysisRepositoryInterface
- constructor Domain\Repository\DependencyGraphRepositoryInterface
- constructor Domain\Service\CodeScannerInterface
- use Domain\Constants
- use Domain\Repository\DependencyGraphRepositoryInterface
- use Domain\Repository\FileAnalysisRepositoryInterface
- use Domain\Service\CodeScannerInterface
Klassen 1
-
GetCodeAnalysisUseCaseclass Zeile 14
Funktionen 9
-
__construct()public Zeile 16 -
execute()public Zeile 27 -
findById()public Zeile 35 -
getStatistics()public Zeile 43 -
getFilterOptions()public Zeile 51 -
runScan()public Zeile 62 -
getLatestScanId()public Zeile 67 -
findDependents()public Zeile 77 -
getGlobalGraphData()public Zeile 87
Verwendet von 2
- CodeAnalysisController.php constructor
- CodeAnalysisController.php use
Versionen 6
-
v6
2025-12-27 23:22 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v5
2025-12-27 23:22 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v4
2025-12-25 12:46 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v3
2025-12-25 12:46 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v2
2025-12-23 15:40 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v1
2025-12-23 15:28 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation
Code
<?php
declare(strict_types=1);
namespace UseCases\CodeAnalysis;
// @responsibility: Orchestriert Code-Analyse-Abfragen
use Domain\Constants;
use Domain\Repository\DependencyGraphRepositoryInterface;
use Domain\Repository\FileAnalysisRepositoryInterface;
use Domain\Service\CodeScannerInterface;
final class GetCodeAnalysisUseCase
{
public function __construct(
private FileAnalysisRepositoryInterface $fileRepository,
private DependencyGraphRepositoryInterface $dependencyRepository,
private CodeScannerInterface $scanner
) {
}
/**
* @param array<string, mixed> $filters
* @return array<array<string, mixed>>
*/
public function execute(array $filters = [], int $limit = Constants::DEFAULT_LIMIT, int $offset = 0): array
{
return $this->fileRepository->findAll($filters, $limit, $offset);
}
/**
* @return array<string, mixed>|null
*/
public function findById(int $id): ?array
{
return $this->fileRepository->findById($id);
}
/**
* @return array<string, mixed>
*/
public function getStatistics(): array
{
return $this->fileRepository->getStatistics();
}
/**
* @return array{directories: array<string>, namespaces: array<string>}
*/
public function getFilterOptions(): array
{
return [
'directories' => $this->fileRepository->getDistinctDirectories(),
'namespaces' => $this->fileRepository->getDistinctNamespaces(),
];
}
/**
* @return array{scan_id: string, files_scanned: int, files_with_errors: int, total_classes: int, total_functions: int, duration_ms: int}
*/
public function runScan(string $triggeredBy = 'web'): array
{
return $this->scanner->scan(null, $triggeredBy);
}
public function getLatestScanId(): ?string
{
return $this->fileRepository->getLatestScanId();
}
/**
* Find files that depend on a given FQCN.
*
* @return array<array{id: int, file_name: string, file_path: string, namespace: string|null, dependency_type: string}>
*/
public function findDependents(string $fqcn): array
{
return $this->dependencyRepository->findDependents($fqcn);
}
/**
* Get global graph data for entire project.
*
* @return array{nodes: array<array<string, mixed>>, links: array<array<string, mixed>>, stats: array<string, int>}
*/
public function getGlobalGraphData(): array
{
return $this->dependencyRepository->getGlobalGraphData();
}
}