{
"event": "PreToolUse",
"tool_name": "Read",
"tool_input": {
"file_path": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Framework\/Container.php",
"limit": 80
}
}
{
"tool_response": {
"type": "text",
"file": {
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Framework\/Container.php",
"content": "<?php\n\ndeclare(strict_types=1);\n\nnamespace Framework;\n\n\/\/ @responsibility: DI-Container mit Autowiring und Singleton-Caching\n\nuse ReflectionClass;\nuse ReflectionNamedType;\nuse ReflectionParameter;\n\nfinal class Container\n{\n \/** @var array<string, object> Cached singleton instances *\/\n private array $instances = [];\n\n \/** @var array<string, callable> Factory functions *\/\n private array $factories = [];\n\n \/**\n * Register a factory for a service.\n *\n * @param string $id Service identifier (usually class name)\n * @param callable(Container): object $factory Factory function\n *\/\n public function set(string $id, callable $factory): void\n {\n $this->factories[$id] = $factory;\n \/\/ Clear cached instance if re-registering\n unset($this->instances[$id]);\n }\n\n \/**\n * Register an existing instance as a singleton.\n *\n * @param string $id Service identifier\n * @param object $instance The instance to register\n *\/\n public function instance(string $id, object $instance): void\n {\n $this->instances[$id] = $instance;\n }\n\n \/**\n * Check if a service is registered.\n *\/\n public function has(string $id): bool\n {\n return isset($this->instances[$id]) || isset($this->factories[$id]) || class_exists($id);\n }\n\n \/**\n * Get a service by ID.\n *\n * Resolution order:\n * 1. Check cached instances\n * 2. Check registered factories\n * 3. Try autowiring if ID is a class name\n *\n * @param string $id Service identifier (usually class name)\n * @return object The resolved service instance\n * @throws ContainerException If service cannot be resolved\n *\/\n public function get(string $id): object\n {\n \/\/ Return cached instance if available\n if (isset($this->instances[$id])) {\n return $this->instances[$id];\n }\n\n \/\/ Use factory if registered\n if (isset($this->factories[$id])) {\n $this->instances[$id] = ($this->factories[$id])($this);\n\n return $this->instances[$id];\n }\n\n \/\/ Try autowiring for class names\n if (class_exists($id)) {",
"numLines": 80,
"startLine": 1,
"totalLines": 176
}
}
}