| Total Complexity | 6 |
| Total Lines | 50 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | class FormEvent extends AbstractEvent |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * @var FormInterface[] |
||
| 15 | */ |
||
| 16 | private $forms = []; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @var FieldDefinitionInterface[] |
||
| 20 | */ |
||
| 21 | private $definitions = []; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @param FormInterface $form |
||
| 25 | * @param string $identifier |
||
| 26 | * |
||
| 27 | * @throws Exception |
||
| 28 | */ |
||
| 29 | public function addForm(FormInterface $form, string $identifier) |
||
| 30 | { |
||
| 31 | if (array_key_exists($identifier, $this->forms)) { |
||
| 32 | throw new Exception('A form with the identifier "'.$identifier.'" was already added'); |
||
| 33 | } |
||
| 34 | $this->forms[$identifier] = $form; |
||
| 35 | } |
||
| 36 | |||
| 37 | /** |
||
| 38 | * @return FormInterface[] |
||
| 39 | */ |
||
| 40 | public function getForms() |
||
| 41 | { |
||
| 42 | return $this->forms; |
||
| 43 | } |
||
| 44 | |||
| 45 | public function addFieldDefinition(string $name, FieldDefinitionInterface $definition): void |
||
| 48 | } |
||
| 49 | |||
| 50 | public function removeFieldDefinition(string $name): void |
||
| 53 | } |
||
| 54 | |||
| 55 | /** |
||
| 56 | * @return FieldDefinition[] |
||
| 57 | */ |
||
| 58 | public function getFieldDefinitions(): array |
||
| 63 |