eee
This commit is contained in:
+9
-3
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user