$definition Full definition array including 'elements', 'email_key' and 'success_message'. */ public function __construct(string $id, array $definition) { $this->_elements = []; if (array_key_exists('elements', $definition)) { foreach ($definition['elements'] as $element) { array_push($this->_elements, RsvFormElementDefinition::fromArray($element)); } } $this->_id = $id; $this->email_key = $definition['email_key'] ?? ''; $this->membership = $definition['membership'] ?? []; $this->success_message = $definition['success_message'] ?? ''; } public function getId(): string { return $this->_id; } public function getEmailKey(): string { return $this->email_key; } /** @return array */ public function getMembershipBindings(): array { return $this->membership['bindings'] ?? []; } public function getMembershipCombine(): string { return $this->membership['combine'] ?? 'max'; } /** Template shown to the visitor after a successful submission. */ public function getSuccessMessage(): string { return $this->success_message; } public function hasElements() : bool { return count($this->_elements) > 0; } /** * @return array */ public function getElements() : array { return $this->_elements; } }