$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 */ public function getElements() : array { return $this->_elements; } }