refactor: comments

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-06-28 18:07:13 -04:00
parent d266b29e62
commit e04957de5e
6 changed files with 8 additions and 48 deletions
-8
View File
@@ -11,14 +11,6 @@ namespace KTXM\PeopleManager\Import;
use KTXM\PeopleManager\Stream\ExpectedTotal;
/**
* Carries the total number of vCards discovered in the source.
* Yielded once, before any object events, when counting is enabled.
*
* The stream envelope consumes this as the `control:start` total (the progress
* denominator); it is never emitted as a `data` frame, so it carries no payload
* of its own.
*/
final readonly class ImportCountEvent implements ImportEvent, ExpectedTotal {
public function __construct(
-6
View File
@@ -11,11 +11,5 @@ namespace KTXM\PeopleManager\Import;
use JsonSerializable;
/**
* Marker interface for events yielded by the contact import generator.
*
* Each event serializes to a flat NDJSON frame (no nested envelope); the
* controller appends the transaction id and streams it as one line.
*/
interface ImportEvent extends JsonSerializable {
}
-3
View File
@@ -9,9 +9,6 @@ declare(strict_types=1);
namespace KTXM\PeopleManager\Import;
/**
* Yielded once per vCard processed, carrying its disposition and any errors.
*/
final readonly class ImportObjectEvent implements ImportEvent {
/**
+5 -11
View File
@@ -11,9 +11,6 @@ namespace KTXM\PeopleManager\Import;
use InvalidArgumentException;
/**
* Configuration for a contact import run.
*/
final class ImportOptions {
public const ERROR_CONTINUE = 0;
@@ -63,14 +60,11 @@ final class ImportOptions {
*/
public static function fromArray(array $data): self {
$options = new self();
if (isset($data['supersede'])) {
$options->setSupersede((bool)$data['supersede']);
}
if (isset($data['counts'])) {
$options->setCounts((bool)$data['counts']);
}
if (isset($data['errors'])) {
$options->setErrors((int)$data['errors']);
$options->supersede = (bool)($data['supersede'] ?? false);
$options->counts = (bool)($data['counts'] ?? true);
$options->errors = (int)($data['errors'] ?? self::ERROR_CONTINUE);
if (!in_array($options->errors, [self::ERROR_CONTINUE, self::ERROR_FAIL], true)) {
throw new InvalidArgumentException('Invalid errors option specified');
}
return $options;
}
+1 -15
View File
@@ -22,20 +22,6 @@ use Sabre\VObject\Property;
use Sabre\VObject\Splitter\VCard as VCardSplitter;
use Throwable;
/**
* Streams vCards from a file resource, maps each to a people entity, and creates
* it in the target collection — yielding one ImportEvent per card.
*
* Memory profile: one vCard is held at a time (sabre's streaming splitter), the
* generator keeps no running collection, and the discovered count is obtained by a
* cheap byte scan rather than a second parse. See modules/people/.ideas/vcf-import.md.
*
* v1 scope: every card is created (disposition `created`) or fails (`error`). The
* vCard UID is mapped to the entity `urid` so future supersede/exists detection is
* possible, but the local provider keys entities on a fresh server id and exposes no
* UID lookup, so supersede/updated/exists are deferred. Individual ORG affiliation
* mapping is also deferred (the ORG property on individual cards is not yet mapped).
*/
class ImportService {
public function __construct(
@@ -43,7 +29,7 @@ class ImportService {
) {}
/**
* @param resource $source readable, seekable file resource containing one or more vCards
* @param resource $source readable, seekable file resource containing one or more objects
*
* @return Generator<int, ImportEvent>
*/