Files

46 lines
1.1 KiB
PHP
Raw Permalink Normal View History

2026-06-11 19:03:29 +02:00
<?php
class RsvFormDefinition {
public $_elements = [];
public string $_id = "";
public string $email_key = "";
/**
* @param array<int,mixed> $definition Full definition array including 'elements' and 'email_key'.
*/
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'] ?? '';
}
public function getId(): string {
return $this->_id;
}
public function getEmailKey(): string {
return $this->email_key;
}
public function hasElements() : bool {
return count($this->_elements) > 0;
}
/**
* @return array<int, RsvFormElementDefinition>
*/
public function getElements() : array {
return $this->_elements;
}
}