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