misuzu/src/Config/IConfig.php

24 lines
1,012 B
PHP

<?php
namespace Misuzu\Config;
// getValue (and hasValue?) should probably be replaced with something that allows grouped loading
// that way the entire config doesn't have to be kept in memory on every request
// this probably has to be delayed until the backwards compat static Config object isn't needed anymore
// otherwise there'd be increased overhead
// bulk operations for setValue and removeValue would also be cool
interface IConfig {
public const T_ANY = '';
public const T_STR = 'string';
public const T_INT = 'integer';
public const T_BOOL = 'boolean';
public const T_ARR = 'array';
public function scopeTo(string $prefix): IConfig;
public function getNames(): array;
public function getValue(string $name, string $type = IConfig::T_ANY, $default = null): mixed;
public function hasValue(string $name): bool;
public function setValue(string $name, $value, bool $save = true): void;
public function removeValue(string $name, bool $save = true): void;
}