1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2025-11-08 05:30:05 +01:00

Allow reading of configuration files

This commit is contained in:
2022-05-18 19:45:16 +02:00
parent 0579ebb1c1
commit 2e61479c75
2 changed files with 29 additions and 4 deletions

View File

@@ -53,12 +53,19 @@ class PhpConfigurationFile: CreatedFromFile {
// MARK: API
public func has(key: String) {
// TODO
public func has(key: String) -> Bool {
return self.content.contains { (_: String, section: Section) in
return section.keys.contains(key)
}
}
public func value(for key: String) {
// TODO
public func get(for key: String) -> String? {
for (_, section) in self.content {
if section.keys.contains(key) {
return section[key]
}
}
return nil
}
public func replace(key: String, value: String) {