eee
This commit is contained in:
+7
-8
@@ -10,13 +10,12 @@ class HotReloadState
|
|||||||
|
|
||||||
public function store(array $changedFiles): void
|
public function store(array $changedFiles): void
|
||||||
{
|
{
|
||||||
|
$normalizedFiles = array_map([$this, 'normalizePath'], array_filter($changedFiles));
|
||||||
|
$normalizedFiles = array_values(array_unique($normalizedFiles));
|
||||||
|
|
||||||
$payload = [
|
$payload = [
|
||||||
'timestamp' => time(),
|
'timestamp' => time(),
|
||||||
'changed_files' => $changedFiles
|
'changed_files' => $normalizedFiles,
|
||||||
|> array_filter(...)
|
|
||||||
|> (fn($x) => array_map([$this, 'normalizePath'], $x))
|
|
||||||
|> array_unique(...)
|
|
||||||
|> array_values(...),
|
|
||||||
];
|
];
|
||||||
|
|
||||||
$directory = dirname($this->getFilePath());
|
$directory = dirname($this->getFilePath());
|
||||||
@@ -50,9 +49,9 @@ class HotReloadState
|
|||||||
}
|
}
|
||||||
|
|
||||||
$files = is_array($data['changed_files'] ?? null) ? $data['changed_files'] : [];
|
$files = is_array($data['changed_files'] ?? null) ? $data['changed_files'] : [];
|
||||||
return array_map([$this, 'normalizePath'], $files)
|
$files = array_map([$this, 'normalizePath'], $files);
|
||||||
|> array_unique(...)
|
$files = array_values(array_unique($files));
|
||||||
|> array_values(...);
|
return $files;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getFilePath(): string
|
private function getFilePath(): string
|
||||||
|
|||||||
+3
-4
@@ -85,10 +85,9 @@ class ScanManifest
|
|||||||
return array_keys($this->entries);
|
return array_keys($this->entries);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->entries
|
$keys = array_keys($this->entries);
|
||||||
|> array_keys(...)
|
$filtered = array_filter($keys, fn(string $path) => str_starts_with($path, $prefix));
|
||||||
|> (fn($x) => array_filter($x, fn(string $path) => str_starts_with($path, $prefix)))
|
return array_values($filtered);
|
||||||
|> array_values(...);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user