[WIP] Mounts TOML + XML parsers

This commit is contained in:
slawkens
2026-02-26 19:48:16 +01:00
parent 8a5823a69c
commit f975bd2f2a
3 changed files with 112 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
<?php
namespace MyAAC\Server\TOML;
use Devium\Toml\Toml;
class Mounts
{
private array $mounts = [];
const FILE = 'config/mounts.toml';
public function load(): void
{
$file = config('server_path') . self::FILE;
if(!@file_exists($file)) {
return;
}
$toml = file_get_contents($file);
$mounts = Toml::decode($toml, asArray: true);
foreach ($mounts as $name => $mount)
{
$this->mounts[] = [
'id' => $mount['id'],
'client_id' => $mount['clientid'] ?? false,
'name' => $name,
'speed' => $mount['speed'] ?? 0,
'premium' => $mount['premium'] ?? false,
];
}
}
public function get(): array {
return $this->mounts;
}
}