Code Duplication    Length = 53-56 lines in 4 locations

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

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

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

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

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

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

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

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