39 protected array $providers = [];
43 public function __construct(){
45 $this->
default = $leveldb;
46 $this->addProvider($leveldb,
"leveldb");
57 return $this->default;
61 $this->default = $class;
64 public function addProvider(WorldProviderManagerEntry $providerEntry,
string $name,
bool $overwrite =
false) : void{
65 $name = strtolower($name);
66 if(!$overwrite && isset($this->providers[$name])){
67 throw new \InvalidArgumentException(
"Alias \"$name\" is already assigned");
70 $this->providers[$name] = $providerEntry;
81 foreach(Utils::stringifyKeys($this->providers) as $alias => $providerEntry){
82 if($providerEntry->isValid($path)){
83 $result[$alias] = $providerEntry;
94 return $this->providers;
101 return $this->providers[trim(strtolower($name))] ?? null;