69 lines
1.2 KiB
PHP
69 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Services\Import;
|
|
|
|
final class ImportResult
|
|
{
|
|
private int $imported = 0;
|
|
|
|
private int $skipped = 0;
|
|
|
|
private int $updated = 0;
|
|
|
|
private int $failed = 0;
|
|
|
|
/** @var string[] */
|
|
private array $errors = [];
|
|
|
|
public function incrementImported(): void
|
|
{
|
|
$this->imported++;
|
|
}
|
|
|
|
public function incrementSkipped(): void
|
|
{
|
|
$this->skipped++;
|
|
}
|
|
|
|
public function incrementUpdated(): void
|
|
{
|
|
$this->updated++;
|
|
}
|
|
|
|
public function addError(string $message): void
|
|
{
|
|
$this->failed++;
|
|
$this->errors[] = $message;
|
|
}
|
|
|
|
public function imported(): int
|
|
{
|
|
return $this->imported;
|
|
}
|
|
|
|
public function skipped(): int
|
|
{
|
|
return $this->skipped;
|
|
}
|
|
|
|
public function updated(): int
|
|
{
|
|
return $this->updated;
|
|
}
|
|
|
|
public function failed(): int
|
|
{
|
|
return $this->failed;
|
|
}
|
|
|
|
/** @return string[] */
|
|
public function errors(): array
|
|
{
|
|
return $this->errors;
|
|
}
|
|
|
|
public function summary(): string
|
|
{
|
|
return "Importiert: {$this->imported} | Übersprungen: {$this->skipped} | Aktualisiert: {$this->updated} | Fehler: {$this->failed}";
|
|
}
|
|
}
|