feat: import people
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXM\PeopleManager\Import;
|
||||
|
||||
/**
|
||||
* Yielded once per vCard processed, carrying its disposition and any errors.
|
||||
*/
|
||||
final readonly class ImportObjectEvent implements ImportEvent {
|
||||
|
||||
/**
|
||||
* @param list<string> $errors
|
||||
*/
|
||||
public function __construct(
|
||||
public ?string $identifier,
|
||||
public ImportDisposition $disposition,
|
||||
public array $errors = [],
|
||||
) {}
|
||||
|
||||
public function isError(): bool {
|
||||
return $this->disposition === ImportDisposition::Error;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{identifier: ?string, disposition: string, errors: list<string>}
|
||||
*/
|
||||
public function jsonSerialize(): array {
|
||||
return [
|
||||
'identifier' => $this->identifier,
|
||||
'disposition' => $this->disposition->value,
|
||||
'errors' => $this->errors,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user