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