1: <?php declare(strict_types=1);
2:
3: namespace Salient\Sync;
4:
5: use Salient\Contract\Core\DateFormatterInterface;
6: use Salient\Contract\Sync\SyncEntityInterface;
7: use Salient\Contract\Sync\SyncStoreInterface;
8: use Salient\Core\AbstractBuilder;
9: use Closure;
10:
11: /**
12: * A fluent SyncSerializeRules factory
13: *
14: * @method $this dateFormatter(DateFormatterInterface|null $value) Date formatter used to serialize date and time values
15: * @method $this includeMeta(bool|null $value = true) Serialize undeclared property values? (default: true)
16: * @method $this sortByKey(bool|null $value = true) Sort serialized entities by key? (default: false)
17: * @method $this maxDepth(int|null $value) Maximum depth of nested values (default: 99)
18: * @method $this detectRecursion(bool|null $value = true) Detect recursion when serializing nested entities? (default: true)
19: * @method $this recurseRules(bool|null $value = true) Apply path-based rules to nested instances of the entity? (default: true)
20: * @method $this forSyncStore(bool|null $value = true) Are values being serialized for an entity store? (default: false)
21: * @method $this includeCanonicalId(bool|null $value = true) Serialize canonical identifiers of sync entities? (default: false)
22: * @method $this remove(array<array<(array{string,...}&array<(Closure(mixed, SyncStoreInterface|null, SyncSerializeRules<TEntity>): mixed)|string|null>)|string>|(array{string,...}&array<(Closure(mixed, SyncStoreInterface|null, SyncSerializeRules<TEntity>): mixed)|string|null>)|string> $value) Values to remove, e.g. `[OrgUnit::class => ['users']]` to remove `users` from `OrgUnit` objects
23: * @method $this replace(array<array<(array{string,...}&array<(Closure(mixed, SyncStoreInterface|null, SyncSerializeRules<TEntity>): mixed)|string|null>)|string>|(array{string,...}&array<(Closure(mixed, SyncStoreInterface|null, SyncSerializeRules<TEntity>): mixed)|string|null>)|string> $value) Values to replace, e.g. `[User::class => [['org_unit', 'org_unit_id', fn($ou) => $ou->Id]]]` to replace `"org_unit" => $entity` with `"org_unit_id" => $entity->Id` in `User` objects
24: *
25: * @template TEntity of SyncEntityInterface
26: *
27: * @extends AbstractBuilder<SyncSerializeRules<TEntity>>
28: *
29: * @generated
30: */
31: final class SyncSerializeRulesBuilder extends AbstractBuilder
32: {
33: /**
34: * @internal
35: */
36: protected static function getService(): string
37: {
38: return SyncSerializeRules::class;
39: }
40:
41: /**
42: * Entity to which the rules apply (required)
43: *
44: * @template T of SyncEntityInterface
45: *
46: * @param class-string<T> $value
47: * @return static<T>
48: */
49: public function entity(string $value)
50: {
51: /** @var static<T> */
52: return $this->withValueB(__FUNCTION__, $value);
53: }
54:
55: /**
56: * Inherit rules from another instance
57: *
58: * @template T of SyncEntityInterface
59: *
60: * @param SyncSerializeRules<T>|null $value
61: * @return static<T>
62: */
63: public function inherit(?SyncSerializeRules $value)
64: {
65: /** @var static<T> */
66: return $this->withValueB(__FUNCTION__, $value);
67: }
68: }
69: