Code Duplication    Length = 54-57 lines in 4 locations

src/Kunstmaan/FormBundle/Entity/FormSubmissionFieldTypes/BooleanFormSubmissionField.php 1 location

@@ 16-72 (lines=57) @@
13
 * @ORM\Entity
14
 * @ORM\Table(name="kuma_boolean_form_submission_fields")
15
 */
16
class BooleanFormSubmissionField extends FormSubmissionField
17
{
18
19
    /**
20
     * @ORM\Column(name="bfsf_value", type="boolean", nullable=true)
21
     */
22
    protected $value;
23
24
    /**
25
     * Returns the default form type for this FormSubmissionField
26
     *
27
     * @return string
28
     */
29
    public function getDefaultAdminType()
30
    {
31
        return BooleanFormSubmissionType::class;
32
    }
33
34
    /**
35
     * Returns a string representation of this FormSubmissionField
36
     *
37
     * @return string
38
     */
39
    public function __toString()
40
    {
41
        $value = $this->getValue();
42
        if (empty($value)) {
43
            return "false";
44
        } else {
45
            return "true";
46
        }
47
    }
48
49
    /**
50
     * Get the value of this field
51
     *
52
     * @return boolean
53
     */
54
    public function getValue()
55
    {
56
        return $this->value;
57
    }
58
59
    /**
60
     * Set the value of this field
61
     *
62
     * @param boolean $value
63
     *
64
     * @return BooleanFormSubmissionField
65
     */
66
    public function setValue($value)
67
    {
68
        $this->value = $value;
69
70
        return $this;
71
    }
72
}
73

src/Kunstmaan/FormBundle/Entity/FormSubmissionFieldTypes/EmailFormSubmissionField.php 1 location

@@ 15-68 (lines=54) @@
12
 * @ORM\Entity
13
 * @ORM\Table(name="kuma_email_form_submission_fields")
14
 */
15
class EmailFormSubmissionField extends FormSubmissionField
16
{
17
18
    /**
19
     * @ORM\Column(name="efsf_value", type="string")
20
     */
21
    protected $value;
22
23
    /**
24
     * Returns the default form type for this FormSubmissionField
25
     *
26
     * @return string
27
     */
28
    public function getDefaultAdminType()
29
    {
30
        return EmailFormSubmissionType::class;
31
    }
32
33
    /**
34
     * Return a string representation of this FormSubmissionField
35
     *
36
     * @return string
37
     */
38
    public function __toString()
39
    {
40
        $value = $this->getValue();
41
42
        return !empty($value) ? $value : "";
43
    }
44
45
    /**
46
     * Returns the current value of this field
47
     *
48
     * @return string
49
     */
50
    public function getValue()
51
    {
52
        return $this->value;
53
    }
54
55
    /**
56
     * Sets the current value of this field
57
     *
58
     * @param string $value
59
     *
60
     * @return EmailFormSubmissionField
61
     */
62
    public function setValue($value)
63
    {
64
        $this->value = $value;
65
66
        return $this;
67
    }
68
}
69

src/Kunstmaan/FormBundle/Entity/FormSubmissionFieldTypes/StringFormSubmissionField.php 1 location

@@ 15-68 (lines=54) @@
12
 * @ORM\Entity
13
 * @ORM\Table(name="kuma_string_form_submission_fields")
14
 */
15
class StringFormSubmissionField extends FormSubmissionField
16
{
17
18
    /**
19
     * @ORM\Column(name="sfsf_value", type="string")
20
     */
21
    protected $value;
22
23
    /**
24
     * Returns the default form type for this FormSubmissionField
25
     *
26
     * @return string
27
     */
28
    public function getDefaultAdminType()
29
    {
30
        return StringFormSubmissionType::class;
31
    }
32
33
    /**
34
     * Return a string representation of this FormSubmissionField
35
     *
36
     * @return string
37
     */
38
    public function __toString()
39
    {
40
        $value = $this->getValue();
41
42
        return !empty($value) ? $value : "";
43
    }
44
45
    /**
46
     * Returns the current value of this field
47
     *
48
     * @return string
49
     */
50
    public function getValue()
51
    {
52
        return $this->value;
53
    }
54
55
    /**
56
     * Sets the current value of this field
57
     *
58
     * @param string $value
59
     *
60
     * @return StringFormSubmissionField
61
     */
62
    public function setValue($value)
63
    {
64
        $this->value = $value;
65
66
        return $this;
67
    }
68
}
69

src/Kunstmaan/FormBundle/Entity/FormSubmissionFieldTypes/TextFormSubmissionField.php 1 location

@@ 16-70 (lines=55) @@
13
 * @ORM\Entity
14
 * @ORM\Table(name="kuma_text_form_submission_fields")
15
 */
16
class TextFormSubmissionField extends FormSubmissionField
17
{
18
19
    /**
20
     * @ORM\Column(name="tfsf_value", type="text")
21
     */
22
    protected $value;
23
24
    /**
25
     * Return the current string value
26
     *
27
     * @return string
28
     */
29
    public function getValue()
30
    {
31
        return $this->value;
32
    }
33
34
    /**
35
     * Sets the string value for this FormSubmissionField
36
     *
37
     * @param string $value
38
     *
39
     * @return TextFormSubmissionField
40
     */
41
    public function setValue($value)
42
    {
43
        $this->value = $value;
44
45
        return $this;
46
    }
47
48
    /**
49
     * Returns the default form type for this FormSubmissionField
50
     *
51
     * @return string
52
     */
53
    public function getDefaultAdminType()
54
    {
55
        return TextFormSubmissionType::class;
56
    }
57
58
    /**
59
     * Returns a string representation of this FormSubmissionField
60
     *
61
     * @return string
62
     */
63
    public function __toString()
64
    {
65
        $value = $this->getValue();
66
67
        return !empty($value) ? $value : "";
68
    }
69
70
}
71