Code Duplication    Length = 36-37 lines in 2 locations

src/Comment/HTMLForm/CreateCommentForm.php 1 location

@@ 19-54 (lines=36) @@
16
     *
17
     * @param Anax\DI\DIInterface $di a service container
18
     */
19
    public function __construct(DIInterface $di, $user)
20
    {
21
        parent::__construct($di);
22
        $this->form->create(
23
            [
24
                "id" => __CLASS__,
25
            ],
26
            [
27
                "title" => [
28
                    "type" => "text",
29
                    "validation" => ["not_empty"],
30
                    "class" => "form-control"
31
                ],
32
33
                "message" => [
34
                    "type" => "textarea",
35
                    "validation" => ["not_empty"],
36
                    "class" => "form-control"
37
                ],
38
                "user" => [
39
                    "type" => "hidden",
40
                    "value" => "$user->id"
41
                ],
42
                "userMail" => [
43
                    "type" => "hidden",
44
                    "value" => "$user->mail"
45
                ],
46
                "submit" => [
47
                    "type" => "submit",
48
                    "value" => "Comment",
49
                    "callback" => [$this, "callbackSubmit"],
50
                    "class" => "btn btn-default"
51
                ],
52
            ]
53
        );
54
    }
55
56
57

src/Comment/HTMLForm/EditCommentForm.php 1 location

@@ 19-55 (lines=37) @@
16
     *
17
     * @param Anax\DI\DIInterface $di a service container
18
     */
19
    public function __construct(DIInterface $di, $comment)
20
    {
21
        parent::__construct($di);
22
        $this->form->create(
23
            [
24
                "id" => __CLASS__,
25
            ],
26
            [
27
                "title" => [
28
                    "type" => "text",
29
                    "validation" => ["not_empty"],
30
                    "class" => "form-control",
31
                    "value" => "$comment->heading"
32
                ],
33
34
                "message" => [
35
                    "type" => "textarea",
36
                    "validation" => ["not_empty"],
37
                    "class" => "form-control",
38
                    "value" => "$comment->msg"
39
                ],
40
41
                "id" => [
42
                    "type" => "hidden",
43
                    "class" => "form-control",
44
                    "value" => "$comment->id"
45
                ],
46
47
                "submit" => [
48
                    "type" => "submit",
49
                    "value" => "Comment",
50
                    "callback" => [$this, "callbackSubmit"],
51
                    "class" => "btn btn-default"
52
                ],
53
            ]
54
        );
55
    }
56
57
58