Backup #1504

ID1504
Dateipfad/var/www/dev.campus.systemische-tools.de/src/ServiceProvider/InfrastructureServiceProvider.php
Version3
Typ modified
Größe7.7 KB
Hashdb694446d8b26c193210d2f90784b52d57f3024e14d1a741bd0f32c6b0eaa8b6
Datum2025-12-25 17:49:55
Geändert vonclaude-code-hook
GrundClaude Code Pre-Hook Backup vor Edit-Operation
Datei existiert Ja

Dateiinhalt

<?php

declare(strict_types=1);

// @responsibility: Register Infrastructure services in DI container

namespace ServiceProvider;

use Domain\Repository\ChunkExplorerRepositoryInterface;
use Domain\Repository\CodeQualityRepositoryInterface;
use Domain\Repository\ContractRepositoryInterface;
use Domain\Repository\DependencyGraphRepositoryInterface;
use Domain\Repository\DokumentationRepositoryInterface;
use Domain\Repository\DokumentExplorerRepositoryInterface;
use Domain\Repository\FileAnalysisRepositoryInterface;
use Domain\Repository\FileBackupRepositoryInterface;
use Domain\Repository\KiProtokollRepositoryInterface;
use Domain\Repository\SeiteExplorerRepositoryInterface;
use Domain\Service\CodeScannerInterface;
use Framework\Container;
use Infrastructure\Audit\AuditService;
use Infrastructure\CodeAnalysis\CodeQualityChecker;
use Infrastructure\CodeAnalysis\CodeScanner;
use Infrastructure\CodeAnalysis\JsFileParser;
use Infrastructure\CodeAnalysis\PhpFileParser;
use Infrastructure\CodeAnalysis\PythonFileParser;
use Infrastructure\Docs\ChunkAnalysisService;
use Infrastructure\Docs\ChunkAnalyzer;
use Infrastructure\Docs\ChunkDataRepository;
use Infrastructure\Docs\ChunkingService;
use Infrastructure\Docs\ChunkSearchService;
use Infrastructure\Docs\ChunkSyncService;
use Infrastructure\Docs\HybridSearchService;
use Infrastructure\Formatter\ApiResponseFormatter;
use Infrastructure\Logging\AuditLogger;
use Infrastructure\Persistence\ChunkExplorerRepository;
use Infrastructure\Persistence\CodeQualityRepository;
use Infrastructure\Persistence\ContractRepository;
use Infrastructure\Persistence\DependencyGraphRepository;
use Infrastructure\Persistence\DokumentationRepository;
use Infrastructure\Persistence\DokumentExplorerRepository;
use Infrastructure\Persistence\FileAnalysisRepository;
use Infrastructure\Persistence\FileBackupRepository;
use Infrastructure\Persistence\KiProtokollRepository;
use Infrastructure\Persistence\SeiteExplorerRepository;

/**
 * InfrastructureServiceProvider registers infrastructure and technical services.
 */
final class InfrastructureServiceProvider implements ServiceProviderInterface
{
    public function register(Container $container): void
    {
        // Repositories
        $container->set(DokumentExplorerRepository::class, fn (Container $c) => new DokumentExplorerRepository($c->get('pdo.dev')));
        $container->set(SeiteExplorerRepository::class, fn (Container $c) => new SeiteExplorerRepository($c->get('pdo.dev')));
        $container->set(ChunkExplorerRepository::class, fn (Container $c) => new ChunkExplorerRepository($c->get('pdo.dev')));
        $container->set(DokumentationRepository::class, fn (Container $c) => new DokumentationRepository($c->get('pdo.dev')));
        $container->set(FileBackupRepository::class, fn (Container $c) => new FileBackupRepository($c->get('pdo.dev')));
        $container->set(ContractRepository::class, fn (Container $c) => new ContractRepository($c->get('pdo.dev')));
        $container->set(KiProtokollRepository::class, fn (Container $c) => new KiProtokollRepository($c->get('pdo.dev')));
        $container->set(FileAnalysisRepository::class, fn (Container $c) => new FileAnalysisRepository($c->get('pdo.dev')));
        $container->set(DependencyGraphRepository::class, fn (Container $c) => new DependencyGraphRepository($c->get('pdo.dev')));
        $container->set(CodeQualityRepository::class, fn (Container $c) => new CodeQualityRepository($c->get('pdo.dev')));

        // Interface aliases
        $container->set(DokumentationRepositoryInterface::class, fn (Container $c) => $c->get(DokumentationRepository::class));
        $container->set(DokumentExplorerRepositoryInterface::class, fn (Container $c) => $c->get(DokumentExplorerRepository::class));
        $container->set(SeiteExplorerRepositoryInterface::class, fn (Container $c) => $c->get(SeiteExplorerRepository::class));
        $container->set(ChunkExplorerRepositoryInterface::class, fn (Container $c) => $c->get(ChunkExplorerRepository::class));
        $container->set(FileAnalysisRepositoryInterface::class, fn (Container $c) => $c->get(FileAnalysisRepository::class));
        $container->set(DependencyGraphRepositoryInterface::class, fn (Container $c) => $c->get(DependencyGraphRepository::class));
        $container->set(CodeQualityRepositoryInterface::class, fn (Container $c) => $c->get(CodeQualityRepository::class));
        $container->set(FileBackupRepositoryInterface::class, fn (Container $c) => $c->get(FileBackupRepository::class));
        $container->set(KiProtokollRepositoryInterface::class, fn (Container $c) => $c->get(KiProtokollRepository::class));
        $container->set(ContractRepositoryInterface::class, fn (Container $c) => $c->get(ContractRepository::class));

        // Code Analysis
        $container->set(PhpFileParser::class, fn () => new PhpFileParser());
        $container->set(PythonFileParser::class, fn () => new PythonFileParser());
        $container->set(JsFileParser::class, fn () => new JsFileParser());
        $container->set(CodeQualityChecker::class, fn () => new CodeQualityChecker());

        $container->set(CodeScanner::class, function (Container $c) {
            return new CodeScanner(
                $c->get(FileAnalysisRepositoryInterface::class),
                $c->get(CodeQualityRepositoryInterface::class),
                $c->get(PhpFileParser::class),
                $c->get(PythonFileParser::class),
                $c->get(JsFileParser::class),
                $c->get(CodeQualityChecker::class)
            );
        });

        $container->set(CodeScannerInterface::class, fn (Container $c) => $c->get(CodeScanner::class));

        // Documentation Services
        $container->set(ChunkSearchService::class, function (Container $c) {
            return new ChunkSearchService(
                $c->get(\Infrastructure\AI\QdrantClient::class),
                $c->get(\Infrastructure\AI\OllamaService::class)
            );
        });

        $container->set(ChunkSyncService::class, function (Container $c) {
            return new ChunkSyncService(
                $c->get('pdo.dev'),
                $c->get(\Infrastructure\AI\OllamaService::class),
                $c->get(\Infrastructure\AI\QdrantClient::class)
            );
        });

        $container->set(HybridSearchService::class, function (Container $c) {
            return new HybridSearchService(
                $c->get('pdo.dev'),
                $c->get(\Infrastructure\AI\OllamaService::class)
            );
        });

        // ChunkDataRepository for chunk database operations
        $container->set(ChunkDataRepository::class, function (Container $c) {
            return new ChunkDataRepository($c->get('pdo.dev'));
        });

        // ChunkAnalyzer for LLM-based analysis
        $container->set(ChunkAnalyzer::class, function (Container $c) {
            return new ChunkAnalyzer($c->get(\Infrastructure\AI\OllamaService::class));
        });

        // ChunkAnalysisService orchestrates the analysis
        $container->set(ChunkAnalysisService::class, function (Container $c) {
            return new ChunkAnalysisService(
                $c->get(ChunkDataRepository::class),
                $c->get(ChunkAnalyzer::class)
            );
        });

        $container->set(ChunkingService::class, function (Container $c) {
            return new ChunkingService(
                $c->get('pdo.dev'),
                $c->get(DokumentationRepository::class)
            );
        });

        // Application Services
        $container->set(AuditLogger::class, fn (Container $c) => new AuditLogger($c->get('pdo.dev')));
        $container->set(AuditService::class, fn (Container $c) => new AuditService($c->get('pdo.dev')));
        $container->set(ApiResponseFormatter::class, fn () => new ApiResponseFormatter());
    }
}

Vollständig herunterladen

Aktionen

Herunterladen

Andere Versionen dieser Datei

ID Version Typ Größe Datum
2108 13 modified 9.2 KB 2025-12-29 08:48
2107 12 modified 9.2 KB 2025-12-29 08:47
2020 11 modified 8.8 KB 2025-12-28 14:26
2019 10 modified 8.8 KB 2025-12-28 14:26
2017 9 modified 8.7 KB 2025-12-28 14:24
1514 8 modified 8.5 KB 2025-12-25 20:08
1513 7 modified 8.2 KB 2025-12-25 20:08
1512 6 modified 8.0 KB 2025-12-25 20:08
1511 5 modified 7.9 KB 2025-12-25 20:08
1505 4 modified 7.7 KB 2025-12-25 17:50
1504 3 modified 7.7 KB 2025-12-25 17:49
1462 2 modified 7.2 KB 2025-12-25 17:01
1459 1 modified 7.1 KB 2025-12-25 17:01

← Zurück zur Übersicht