Files
michaelschiemer/scripts/debug/debug-container.php
Michael Schiemer 887847dde6 refactor: reorganize project structure for better maintainability
- Move 45 debug/test files from root to organized scripts/ directories
- Secure public/ directory by removing debug files (security improvement)
- Create structured scripts organization:
  • scripts/debug/      (20 files) - Framework debugging tools
  • scripts/test/       (18 files) - Test and validation scripts
  • scripts/maintenance/ (5 files) - Maintenance utilities
  • scripts/dev/         (2 files) - Development tools

Security improvements:
- Removed all debug/test files from public/ directory
- Only production files remain: index.php, health.php

Root directory cleanup:
- Reduced from 47 to 2 PHP files in root
- Only essential production files: console.php, worker.php

This improves:
 Security (no debug code in public/)
 Organization (clear separation of concerns)
 Maintainability (easy to find and manage scripts)
 Professional structure (clean root directory)
2025-10-05 10:59:15 +02:00

78 lines
2.9 KiB
PHP

<?php
declare(strict_types=1);
use App\Framework\Attributes\Route;
use App\Framework\Core\AppBootstrapper;
use App\Framework\Discovery\Results\DiscoveryRegistry;
use App\Framework\Performance\EnhancedPerformanceCollector;
use App\Framework\DateTime\SystemClock;
use App\Framework\DateTime\SystemHighResolutionClock;
use App\Framework\Performance\MemoryMonitor;
require __DIR__ . '/vendor/autoload.php';
require __DIR__ . '/src/Framework/Debug/helpers.php';
echo "DEBUG: Starting container debug\n";
// Create dependencies for enhanced performance collector
$basePath = __DIR__;
$clock = new SystemClock();
$highResClock = new SystemHighResolutionClock();
$memoryMonitor = new MemoryMonitor();
$collector = new EnhancedPerformanceCollector($clock, $highResClock, $memoryMonitor, enabled: true);
echo "DEBUG: About to create AppBootstrapper\n";
$bootstrapper = new AppBootstrapper($basePath, $collector, $memoryMonitor);
echo "DEBUG: About to bootstrap web app\n";
$app = $bootstrapper->bootstrapWeb();
echo "DEBUG: Web app bootstrapped successfully\n";
// Get container from the app
$reflection = new ReflectionObject($app);
$containerProperty = $reflection->getProperty('container');
$containerProperty->setAccessible(true);
$container = $containerProperty->getValue($app);
echo "DEBUG: Got container from app\n";
// Check if DiscoveryRegistry is available
if ($container->has(DiscoveryRegistry::class)) {
echo "DEBUG: DiscoveryRegistry is available in container\n";
$registry = $container->get(DiscoveryRegistry::class);
$routeCount = $registry->attributes->getCount(Route::class);
echo "DEBUG: Found $routeCount route attributes in registry\n";
if ($routeCount > 0) {
$routes = $registry->attributes->get(Route::class);
echo "DEBUG: First few routes:\n";
foreach (array_slice($routes, 0, 3) as $i => $route) {
echo " Route $i: " . $route->className->getFullyQualified() . "::" . $route->methodName?->toString() . "\n";
}
// Look for the home route specifically
echo "DEBUG: Looking for home route (/)\n";
$homeFound = false;
foreach ($routes as $route) {
$instance = $route->createAttributeInstance();
if ($instance instanceof \App\Framework\Attributes\Route && $instance->path === '/') {
echo " HOME ROUTE FOUND: " . $route->className->getFullyQualified() . "::" . $route->methodName?->toString() . " -> " . $instance->path . "\n";
$homeFound = true;
}
}
if (!$homeFound) {
echo " HOME ROUTE NOT FOUND in discovery results\n";
}
} else {
echo "DEBUG: No routes found in registry\n";
}
echo "DEBUG: Total discovery items: " . count($registry) . "\n";
} else {
echo "DEBUG: DiscoveryRegistry is NOT available in container\n";
}
echo "DEBUG: Debug complete\n";