diff --git a/src/FileMap.php b/src/FileMap.php index c079f55..ae72a38 100644 --- a/src/FileMap.php +++ b/src/FileMap.php @@ -21,6 +21,16 @@ final class FileMap /** @var array */ private array $pendingFiles = []; + /** + * @param array $files + * @param array $splFiles + */ + public function __construct(array $files = [], array $splFiles = []) + { + $this->map = $files; + $this->pendingFiles = $splFiles; + } + /** * @return T|null */ @@ -46,14 +56,6 @@ public function put(File $file, SplFileInfo $fileInfo): void $this->pendingFiles[$id] = $file; } - /** - * @param T $file - */ - private function getObjectId(File $file): int - { - return spl_object_id($file); - } - /** * @param T $file * @return S @@ -84,4 +86,12 @@ public function remove(File $file): void unset($this->map[$id]); unset($this->pendingFiles[$id]); } + + /** + * @param T $file + */ + private function getObjectId(File $file): int + { + return spl_object_id($file); + } } diff --git a/src/Manager.php b/src/Manager.php index a19f473..031dcdc 100644 --- a/src/Manager.php +++ b/src/Manager.php @@ -324,9 +324,7 @@ public function getClass(): string public function clear(): void { - /** @var FileMap $map */ - $map = new FileMap(); - $this->fileMap = $map; + $this->fileMap = new FileMap(); } private function hashFile(SplFileInfo $file): string