{
"event": "PreToolUse",
"tool_name": "Bash",
"tool_input": {
"command": "ssh root@prod.karlkratz.com \"grep -n -A20 'function get' \/var\/www\/prod.karlkratz.de\/src\/Helpers\/ConfigLoader.php\"",
"timeout": 30000,
"description": "Show get method from ConfigLoader"
}
}
{
"tool_response": {
"stdout": "35: public static function getInstance(): ConfigLoader {\n36- if (self::$instance === null) {\n37- self::$instance = new self();\n38- }\n39- return self::$instance;\n40- }\n41-\n42- \/**\n43- * Statischer Hilfsmethode für einfachen Zugriff\n44- *\/\n45- public static function config($key = null, $default = null) {\n46- $instance = self::getInstance();\n47- \n48- if ($key === null) {\n49- return $instance->getAll();\n50- }\n51- \n52- return $instance->get($key, $default);\n53- }\n54-\n55- \/**\n--\n133: public function get(string $key, $default = null) {\n134- if (!$this->initialized) {\n135- $this->loadConfig();\n136- }\n137- \n138- \/\/ Verschachtelter Key mit Punkt-Notation (z.B. 'database.connection.host')\n139- $keys = explode('.', $key);\n140- $value = $this->config;\n141- \n142- foreach ($keys as $segment) {\n143- if (!is_array($value) || !array_key_exists($segment, $value)) {\n144- return $default;\n145- }\n146- $value = $value[$segment];\n147- }\n148- \n149- return $value;\n150- }\n151-\n152- \/**\n153- * Gibt alle Konfigurationswerte zurück\n--\n155: public function getAll(): array {\n156- if (!$this->initialized) {\n157- $this->loadConfig();\n158- }\n159- return $this->config;\n160- }\n161-\n162- \/**\n163- * Prüft, ob ein Konfigurationsschlüssel existiert\n164- *\/\n165- public function has(string $key): bool {\n166- if (!$this->initialized) {\n167- $this->loadConfig();\n168- }\n169- \n170- \/\/ Verschachtelter Key mit Punkt-Notation\n171- $keys = explode('.', $key);\n172- $value = $this->config;\n173- \n174- foreach ($keys as $segment) {\n175- if (!is_array($value) || !array_key_exists($segment, $value)) {\n--\n187: public function getEnvironment(): string {\n188- return $this->environment;\n189- }\n190-\n191- \/**\n192- * Hilfsmethode für die Überprüfung, ob eine bestimmte Umgebung aktiv ist\n193- *\/\n194- public function isEnvironment(string $env): bool {\n195- if (($env === 'production' || $env === 'prod') && $this->environment === 'prod') {\n196- return true;\n197- }\n198- \n199- if (($env === 'development' || $env === 'dev') && $this->environment === 'dev') {\n200- return true;\n201- }\n202- \n203- return $this->environment === $env;\n204- }\n205-\n206- \/**\n207- * Lädt die Konfiguration neu\n--\n241: public static function getJsonConfig(string $configName): array {\n242- $instance = self::getInstance();\n243- return $instance->loadJsonConfig($configName);\n244- }\n245-\n246- \/\/ OLD JSON SYSTEM - AUSKOMMENTIERT\n247- \/*\n248- private $configDir;\n249- \n250- private function loadConfig() {\n251- \/\/ Basis-Konfigurationsdateien\n252- $configFiles = $this->getConfigFiles();\n253- \n254- foreach ($configFiles as $file) {\n255- $this->loadConfigFile($file);\n256- }\n257- \n258- $this->initialized = true;\n259- }\n260-\n261: private function getConfigFiles(): array {\n262- $baseFiles = glob($this->configDir . '*.json');\n263- $envFiles = glob($this->configDir . '*.' . $this->environment . '.json');\n264- \n265- sort($baseFiles);\n266- sort($envFiles);\n267- \n268- return array_merge($baseFiles, $envFiles);\n269- }\n270-\n271- private function loadConfigFile(string $file) {\n272- \/\/ JSON file loading logic...\n273- }\n274-\n275- private function mergeConfigs(array $base, array $override): array {\n276- \/\/ Config merging logic...\n277- }\n278-\n279- private function overrideWithEnv(string $configKey, array $configData): array {\n280- \/\/ ENV override logic...\n281- }",
"stderr": "",
"interrupted": false,
"isImage": false,
"noOutputExpected": false
}
}