Lines
90.90%
10 / 11
Methods
75.00%
3 / 4
Classes
0.00%
0 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| __construct | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| type | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | ||
| describe | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| toMessage | 100.00% | 8 / 8 | 100.00% | 1 / 1 | 1 | ||
| 11 | final readonly class ReconcileExposedEntities implements HaCommand | |
| 12 | { | |
| 13 | public function __construct(public ExposedEntityReconcile $reconcile) {} | |
| 14 | ||
| 15 | public function type(): string | |
| 16 | { | |
| 17 | return 'stewart/entity/reconcile'; | |
| 18 | } | |
| 19 | ||
| 20 | public function describe(): string | |
| 21 | { | |
| 22 | return \sprintf('%s %s keeping %d entities', $this->type(), $this->reconcile->instance, $this->reconcile->keptAddresses->count()); | |
| 23 | } | |
| 24 | ||
| 25 | public function toMessage(): array | |
| 26 | { | |
| 27 | return [ | |
| 28 | 'type' => $this->type(), | |
| 29 | 'instance' => $this->reconcile->instance->value, | |
| 30 | 'keep' => $this->reconcile->keptAddresses->mapToList( | |
| 31 | static fn(ExposedEntityAddress $address): array => ['app' => $address->appId->value, 'key' => $address->key->value], | |
| 32 | ), | |
| 33 | 'keep_apps' => $this->reconcile->keptApps->toStrings(), | |
| 34 | ]; | |
| 35 | } | |
| 36 | } |