App.php
- Pfad:
src/Framework/App.php - Namespace: Framework
- Zeilen: 75 | Größe: 1,876 Bytes
- Geändert: 2025-12-25 13:29:30 | 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 1
- use Framework\Middleware\CorrelationMiddleware
Klassen 1
-
Appclass Zeile 11
Funktionen 6
-
__construct()public Zeile 16 -
run()public Zeile 26 -
dispatch()protected Zeile 36 -
router()public Zeile 44 -
container()public Zeile 49 -
registerServices()protected Zeile 60
Versionen 7
-
v7
2025-12-25 13:29 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v6
2025-12-25 13:17 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v5
2025-12-25 13:10 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v4
2025-12-23 08:09 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v3
2025-12-22 16:47 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v2
2025-12-22 15:30 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v1
2025-12-22 08:53 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation
Code
<?php
declare(strict_types=1);
namespace Framework;
// @responsibility: Applikations-Bootstrap und Service-Registrierung
use Framework\Middleware\CorrelationMiddleware;
class App
{
protected Router $router;
protected Container $container;
public function __construct()
{
$this->container = new Container();
$this->router = new Router();
$this->router->setContainer($this->container);
// Register core services
$this->registerServices();
}
public function run(): void
{
// Run middleware chain
$middleware = new CorrelationMiddleware();
$middleware->handle(fn () => $this->dispatch());
}
/**
* Dispatch the request to the router.
*/
protected function dispatch(): void
{
$uri = parse_url($_SERVER['REQUEST_URI'] ?? '/', PHP_URL_PATH);
$method = $_SERVER['REQUEST_METHOD'] ?? 'GET';
$this->router->dispatch($uri ?? '/', $method);
}
public function router(): Router
{
return $this->router;
}
public function container(): Container
{
return $this->container;
}
/**
* Register core services in the container.
*
* Explicit registrations override autowiring.
* Services without registration will be autowired.
*/
protected function registerServices(): void
{
// Load service definitions if file exists
$servicesFile = dirname(__DIR__) . '/services.php';
if (file_exists($servicesFile)) {
$configure = require $servicesFile;
if (is_callable($configure)) {
$configure($this->container);
}
}
// Eager-load ModelRegistry for deprecated static ModelConfig facade (used in Views)
$this->container->get(\Infrastructure\AI\ModelRegistry::class);
}
}