$settings */ public function __construct( public readonly string $id, public readonly string $type, public readonly string $label, public readonly ?string $connectionId = null, public readonly array $settings = [], ) { } /** * @param array $stored */ public static function fromArray(string $id, array $stored): self { return new self( $id, (string) ($stored['type'] ?? ''), (string) ($stored['label'] ?? ''), isset($stored['connection']) && is_string($stored['connection']) && $stored['connection'] !== '' ? $stored['connection'] : null, is_array($stored['settings'] ?? null) ? $stored['settings'] : [], ); } /** * @return array{type: string, label: string, connection: string|null, settings: array} */ public function toArray(): array { return [ 'type' => $this->type, 'label' => $this->label, 'connection' => $this->connectionId, 'settings' => $this->settings, ]; } }