$valueIndex) { return trim($parts[$valueIndex]); } } } return ''; } /** * Clears the credential cache. */ public static function clearCache(): void { self::$cache = null; } /** * Loads and caches the credentials file. * * @return array */ private static function loadCredentials(): array { if (self::$cache !== null) { return self::$cache; } if (!file_exists(self::CREDENTIALS_FILE)) { throw new RuntimeException('Credentials file not found: ' . self::CREDENTIALS_FILE); } $content = file_get_contents(self::CREDENTIALS_FILE); if ($content === false) { throw new RuntimeException('Failed to read credentials file'); } self::$cache = explode("\n", $content); return self::$cache; } }