This commit is contained in:
2026-06-12 23:57:19 +08:00
parent 0ff2cd7a06
commit 7827b8d5b1
6 changed files with 147 additions and 116 deletions
+9 -3
View File
@@ -6,13 +6,17 @@ namespace Kiri\Di;
class HotReloadState
{
private const MAX_AGE_SECONDS = 30;
private const int MAX_AGE_SECONDS = 30;
public function store(array $changedFiles): void
{
$payload = [
'timestamp' => time(),
'changed_files' => array_values(array_unique(array_map([$this, 'normalizePath'], array_filter($changedFiles)))),
'changed_files' => $changedFiles
|> array_filter(...)
|> (fn($x) => array_map([$this, 'normalizePath'], $x))
|> array_unique(...)
|> array_values(...),
];
$directory = dirname($this->getFilePath());
@@ -46,7 +50,9 @@ class HotReloadState
}
$files = is_array($data['changed_files'] ?? null) ? $data['changed_files'] : [];
return array_values(array_unique(array_map([$this, 'normalizePath'], $files)));
return array_map([$this, 'normalizePath'], $files)
|> array_unique(...)
|> array_values(...);
}
private function getFilePath(): string