/
Wild_RNB
/
ASU
Обзор
Документация
Войти
/
Wild_RNB
/
ASU
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
main
src/Runtime/Persistence.php
28 строк
538 B
am190620045-afk
Add ASU runtime persistence foundation
15 июл 2026, 21:21
15 июл 2026, 21:21
09386e5
Код
Авторство
О чём код?
<?php declare(strict_types=1); namespace ASU\Runtime; final class Persistence { public function __construct(private readonly string $file) { } public function save(array $state): void { file_put_contents($this->file, json_encode($state, JSON_PRETTY_PRINT)); } public function load(): array { if (!is_file($this->file)) { return []; } $data = json_decode((string) file_get_contents($this->file), true); return is_array($data) ? $data : []; } }