Code Duplication    Length = 31-36 lines in 3 locations

src/Comment/HTMLForm/CreateForm.php 1 location

@@ 23-55 (lines=33) @@
20
     * @param ContainerInterface $di a service container
21
     * @param string $questionId the id of the question
22
     */
23
    public function __construct(ContainerInterface $di, string $questionId, string $answerId)
24
    {
25
        error_log("constructor called");
26
        parent::__construct($di);
27
        $this->form->create(
28
            [
29
                "id" => __CLASS__,
30
                "legend" => "Skapa svar",
31
            ],
32
            [
33
                "kommentar" => [
34
                    "type" => "textarea",
35
                    "validation" => ["not_empty"],
36
                ],
37
38
                "answer_id" => [
39
                    "type"        => "hidden",
40
                    "value"       => $answerId,
41
                ],
42
43
                "question_id" => [
44
                    "type"        => "hidden",
45
                    "value"       => $questionId,
46
                ],
47
48
                "submit" => [
49
                    "type" => "submit",
50
                    "value" => "Skapa svar",
51
                    "callback" => [$this, "callbackSubmit"]
52
                ],
53
            ]
54
        );
55
    }
56
57
58

src/Question/HTMLForm/CreateForm.php 1 location

@@ 23-53 (lines=31) @@
20
     *
21
     * @param Psr\Container\ContainerInterface $di a service container
22
     */
23
    public function __construct(ContainerInterface $di)
24
    {
25
        parent::__construct($di);
26
        $this->form->create(
27
            [
28
                "id" => __CLASS__,
29
                "legend" => "Skapa fråga",
30
            ],
31
            [
32
                "titel" => [
33
                    "type" => "text",
34
                    "validation" => ["not_empty"],
35
                ],
36
37
                "fråga" => [
38
                    "type" => "textarea",
39
                    "validation" => ["not_empty"],
40
                ],
41
42
                "tags" => [
43
                    "type" => "text",
44
                ],
45
46
                "submit" => [
47
                    "type" => "submit",
48
                    "value" => "Skapa fråga",
49
                    "callback" => [$this, "callbackSubmit"]
50
                ],
51
            ]
52
        );
53
    }
54
55
56

src/User/HTMLForm/UserLoginForm.php 1 location

@@ 19-54 (lines=36) @@
16
     *
17
     * @param Psr\Container\ContainerInterface $di a service container
18
     */
19
    public function __construct(ContainerInterface $di)
20
    {
21
        parent::__construct($di);
22
23
        $this->form->create(
24
            [
25
                "id" => __CLASS__,
26
                "legend" => "Logga in"
27
            ],
28
            [
29
                "user" => [
30
                    "type"        => "text",
31
                    //"description" => "Here you can place a description.",
32
                    //"placeholder" => "Here is a placeholder",
33
                ],
34
35
                "password" => [
36
                    "type"        => "password",
37
                    //"description" => "Here you can place a description.",
38
                    //"placeholder" => "Here is a placeholder",
39
                ],
40
41
                "submit" => [
42
                    "type" => "submit",
43
                    "value" => "Login",
44
                    "callback" => [$this, "callbackSubmit"]
45
                ],
46
47
                "submit2" => [
48
                    "type" => "submit",
49
                    "value" => "Logout",
50
                    "callback" => [$this, "logOut"]
51
                ],
52
            ]
53
        );
54
    }
55
56
57
    public function logOut() {