| Conditions | 1 |
| Paths | 1 |
| Total Lines | 13 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 1.0202 |
| Changes | 0 | ||
| 1 | <?php |
||
| 29 | public function create(ChatControl $chatControl): Form { |
||
| 30 | 1 | $form = new Form(); |
|
| 31 | 1 | $form->setTranslator($this->translator); |
|
| 32 | 1 | $form->addText("message", "") |
|
| 33 | 1 | ->setRequired("chat.newMessageForm.messageField.empty"); |
|
| 34 | 1 | $form->addSubmit("send", "chat.newMessageForm.submitButton.label"); |
|
| 35 | 1 | $form->addComponent($chatControl, "chat"); |
|
| 36 | 1 | $form->onSuccess[] = function(Form $form, array $values) { |
|
| 37 | /** @var ChatControl $chat */ |
||
| 38 | $chat = $form->getComponent("chat"); |
||
| 39 | $chat->newMessage($values["message"]); |
||
| 40 | }; |
||
| 41 | 1 | return $form; |
|
| 42 | } |
||
| 44 | ?> |