Conditions | 1 |
Paths | 1 |
Total Lines | 14 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 2 |
Changes | 4 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
18 | public function create(ChatControl $chatControl): Form { |
||
19 | $form = new Form(); |
||
20 | $form->setTranslator($this->translator); |
||
21 | $form->addText("message", "") |
||
22 | ->setRequired("chat.newMessageForm.messageField.empty"); |
||
23 | $form->addSubmit("send", "chat.newMessageForm.submitButton.label"); |
||
24 | $form->addComponent($chatControl, "chat"); |
||
25 | // @phpstan-ignore assign.propertyType |
||
26 | $form->onSuccess[] = function(Form $form, array $values): void { |
||
27 | /** @var ChatControl $chat */ |
||
28 | $chat = $form->getComponent("chat"); |
||
29 | $chat->newMessage($values["message"]); |
||
30 | }; |
||
31 | return $form; |
||
32 | } |
||
34 | ?> |