chore: complete update

This commit is contained in:
2025-07-17 16:24:20 +02:00
parent 899227b0a4
commit 64a7051137
1300 changed files with 85570 additions and 2756 deletions

View File

@@ -0,0 +1,71 @@
<?php
declare(strict_types=1);
namespace App\Framework\Filesystem;
/**
* Repräsentiert eine Datei im Dateisystem mit Lazy-Loading-Unterstützung.
*
* @property-read string $path Pfad zur Datei
* @property-read Storage $storage Storage-Implementierung
* @property-read string $contents Dateiinhalt (lazy geladen)
* @property-read int $size Dateigröße in Bytes (lazy geladen)
* @property-read int $lastModified Zeitstempel der letzten Änderung (lazy geladen)
*/
final readonly class File
{
public function __construct(
public string $path,
public Storage $storage,
public string $contents = '',
public int $size = 0,
public int $lastModified = 0
) {}
/**
* Prüft, ob die Datei existiert
*/
public function exists(): bool
{
return $this->storage->exists($this->path);
}
/**
* Löscht die Datei
*/
public function delete(): void
{
$this->storage->delete($this->path);
}
/**
* Kopiert die Datei an einen neuen Ort
*/
public function copyTo(string $destination): File
{
$this->storage->copy($this->path, $destination);
return FilesystemFactory::createFile($destination, $this->storage);
}
/**
* Lädt die Dateieigenschaften neu
*/
public function refresh(): File
{
return FilesystemFactory::createFile($this->path, $this->storage);
}
/**
* Holt erweiterte Metadaten der Datei
*/
public function getMetadata(): FileMetadata
{
return new FileMetadata(
size: $this->size,
lastModified: $this->lastModified,
mimeType: $this->storage->getMimeType($this->path),
isReadable: $this->storage->isReadable($this->path),
isWritable: $this->storage->isWritable($this->path)
);
}
}