From ef4a941c8b6d9a5e29893c66cb5adee32a145823 Mon Sep 17 00:00:00 2001 From: Michael Schiemer Date: Mon, 3 Nov 2025 14:40:46 +0100 Subject: [PATCH] refactor: remove unused dependencies and legacy code from ShowHome controller --- src/Application/Website/ShowHome.php | 190 --------------------------- 1 file changed, 190 deletions(-) diff --git a/src/Application/Website/ShowHome.php b/src/Application/Website/ShowHome.php index 875b34ce..7070f7b0 100644 --- a/src/Application/Website/ShowHome.php +++ b/src/Application/Website/ShowHome.php @@ -36,200 +36,10 @@ use App\Infrastructure\GeoIp\GeoIp; final readonly class ShowHome { - public function __construct( - private QueryBus $queryBus, - private DefaultContainer $container, - private Clock $clock, - private DateTimeFormatter $dateTimeFormatter, - private EntityManager $entityManager, - private Cache $cache, - private ConnectionInterface $connection, - private PathProvider $pathProvider, - private UrlGenerator $urlGenerator, - private ImageRepository $imageRepository, - ) { - } - #[Route(path: '/', method: Method::GET, name: WebRoutes::HOME)] public function home(HomeRequest $request, string $test = 'hallo'): ViewResult { - #$imageSlot = $this->entityManager->findOneBy(ImageSlot::class, ['slot_name' => 'slot1']); - - /*$image = $this->imageRepository->findBySlotName('slot1'); - - - - $filepath = $image->filename; - - echo "AltText";*/ - - $model = new HomeViewModel('Hallo Welt!'); - - #$image = $this->imageRepository->findById("06BV7BSMPRX9ADY7XAQ5EC55YW"); - - #$filepath = "images/" . $image->filename; - - #echo "AltText"; - - /*var_dump(sys_getloadavg()); - - # Beginn - $cpu_count = 1; - if(is_file('/proc/cpuinfo')) { - $cpuinfo = file_get_contents('/proc/cpuinfo'); - preg_match_all('/^processor/m', $cpuinfo, $matches); - $cpu_count = count($matches[0]); - } - - $sys_getloadavg = sys_getloadavg(); - $sys_getloadavg[0] = $sys_getloadavg[0] / $cpu_count; - $sys_getloadavg[1] = $sys_getloadavg[1] / $cpu_count; - $sys_getloadavg[2] = $sys_getloadavg[2] / $cpu_count; - - var_dump("
", $sys_getloadavg);
-
-        $cpuinfo = file_get_contents('/proc/cpuinfo');
-
-        #var_dump("
", $cpuinfo);*/
-
-
-
-        $highlighter = new SyntaxHighlighter();
-
-        $code = '';
-
-        #$code = file_get_contents(__DIR__ . '/ShowHome.php');
-
-        #echo new FileHighlighter()(__DIR__ . '/ShowHome.php', 48, 20);
-
-        // Einmalige Initialisierung
-        #$setup = new DatabaseSetup(__DIR__ . '/Infrastructure/GeoIp/data/ip_country.sqlite');
-        #$setup->setupCompleteDatabase();
-
-        // Normale Verwendung
-        $geoIp = new GeoIp(__DIR__ . '/Infrastructure/GeoIp/data/ip_country.sqlite');
-        $countryInfo = $geoIp->getCountryInfo('83.135.161.55');
-
-        /*echo 'Code: ' . $countryInfo->countryCode . "\n";
-        echo 'Deutsch: ' . $countryInfo->getGermanName() . "\n";
-        echo 'English: ' . $countryInfo->getEnglishName() . "\n";
-
-        var_dump($countryInfo);*/
-
-
-
-        $model = new HomeViewModel('Hallo Welt!');
-
-        $aiService = new AiService(new AiHandlerFactory(new CurlHttpClient()));
-
-
-
-
-        /* $status = opcache_get_status(true);
-         unset($status['scripts']);
-
-
-         $response = $aiService->query('Bitte visualisiere mir den OPCache Status kompakt: '.print_r($status, true), AiModel::OLLAMA_QWEN2_5);
-
-         $response = $aiService->query('Du wirst in meinem PHP Framework ausgeführt. Kann ich dir Frameworkdaten irgendwie zugänglich machen?', AiModel::OLLAMA_QWEN2_5, messages: [
-             ['role' => 'system', 'content' => 'Du bist ein hilfreicher Programmier-Assistent.'],
-             ['role' => 'user', 'content' => 'Du wirst in meinem PHP Framework ausgeführt. Kann ich dir Frameworkdaten irgendwie zugänglich machen?'],
-             ['role' => 'user', 'content' => ''],
-             ]);
-
-         $html = new MarkdownConverter()->toHtml($response->content);
-
-         echo $html;*/
-
-
-
-        // Get session from container (available after SessionMiddleware runs)
-        if ($this->container->has(SessionInterface::class)) {
-            $session = $this->container->get(SessionInterface::class);
-
-            if ($session->validation->has('form', 'consent')) {
-                #debug($session->form->get('form'));
-                #debug($session->validation->getField('form', 'consent'));
-                // Only clear the specific form, not all forms
-                $session->validation->clear('form');
-                $session->form->clear('form');
-            }
-        }
-
-
-        // Cache löschen für frische Ergebnisse
-        #$this->cache->forget('unified_discovery_results');
-        #$this->cache->forget('attribute_discovery');
-
-
-        #var_dump("
");
-
-        // Debug-Ausgaben hinzufügen
-        #var_dump('Discovery Results:' , $results->toArray());
-        #var_dump('All Attribute Results:', $results->getAllAttributeResults());
-        #var_dump('Processed File Count:', $discovery->getProcessedFileCount());
-
-        // Teste ob ShowHome gefunden wird
-        $basePath = $this->pathProvider->getBasePath();
-        #debug('Scanning path:', $basePath . '/src');
-
-
-
-        /*
-         *  [Field] => id
-            [Type] => int(11)
-            [Null] => NO
-            [Key] => PRI
-            [Default] =>
-            [Extra] =>
-         */
-
-        /*$tables = $this->connection->query('SHOW FULL TABLES;')->fetchAll();
-        $columns = $this->connection->query('SHOW COLUMNS FROM users;')->fetchAll();
-        $table = "

Table: test

"; - - foreach ($columns as $column) { - $table .= sprintf("", $column['Field'], $column['Type'], $column['Null'], $column['Key'], $column['Default']); - } - $table .= "
FieldTypeNullKeyDefault
%s %s %s %s %s
"; - - echo $table; - - - dd($columns);*/ - - - - $result = $this->queryBus->dispatch(new DemoQuery()); - - #echo $result->test; - - $httpRequest = $this->container->get(Request::class); - - $protocol = $httpRequest->server->getHttpHost(); - - - #debug($this->entityManager->find(User::class, 1)->name, 'User'); - - #$qrCodeService = new QrCodeService(new QrCodeGenerator(new QrCodeEncoder(), new QrCodeRenderer())); - - #$code = $qrCodeService->generateQrCode('Michael Schiemer'); - - #echo $code->toSvg(); - - - #var_dump($this->dateTimeFormatter->formatTime($this->clock->now())); - - return new ViewResult( template: 'test', metaData: new StaticPageMetaResolver(