. */ declare(strict_types=1); namespace SP\Domain\Export\Dtos; use SP\Domain\Common\Dtos\Dto; use SP\Domain\Core\AppInfoInterface; use SP\Infrastructure\File\FileSystem; /** * Class BackupFile */ final class BackupFile extends Dto { public function __construct( private readonly BackupType $backupType, private readonly string $hash, private readonly string $path, private readonly string $extension ) { } public function __toString(): string { return sprintf( '%s_%s-%s.%s', FileSystem::buildPath($this->path, AppInfoInterface::APP_NAME), $this->backupType->name, $this->hash, $this->extension ); } public function withPath(string $path): BackupFile { return new self($this->backupType, $this->hash, $path, $this->extension); } public function withHash(string $hash): BackupFile { return new self($this->backupType, $hash, $this->path, $this->extension); } }