1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2025-11-09 13:10:24 +01:00

Switch Xdebug mode

This commit is contained in:
2022-05-19 01:05:06 +02:00
parent 990152d77d
commit e7f80ebce8
5 changed files with 37 additions and 6 deletions

View File

@@ -15,7 +15,11 @@ class Xdebug {
}
public static var mode: String {
return Command.execute(path: Paths.php, arguments: ["-r", "echo ini_get('xdebug.mode');"])
guard let file = PhpEnv.shared.getConfigFile(forKey: "xdebug.mode") else {
return ""
}
return file.get(for: "xdebug.mode") ?? ""
}
public static var modes: [String] {

View File

@@ -174,4 +174,14 @@ class PhpEnv {
return false
}
/**
Returns the configuration file instance that is used for a specific config value.
You can then use the configuration file instance to change values.
*/
public func getConfigFile(forKey key: String) -> PhpConfigurationFile? {
return PhpEnv.phpInstall.iniFiles
.reversed()
.first(where: { $0.has(key: key) })
}
}