These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Kunstmaan\FormBundle\Entity\FormSubmissionFieldTypes; |
||
4 | |||
5 | use Doctrine\ORM\Mapping as ORM; |
||
6 | use Kunstmaan\FormBundle\Entity\FormSubmissionField; |
||
7 | use Kunstmaan\FormBundle\Form\EmailFormSubmissionType; |
||
8 | |||
9 | /** |
||
10 | * The EmailFormSubmissionField can be used to store email values to a FormSubmission |
||
11 | * |
||
12 | * @ORM\Entity |
||
13 | * @ORM\Table(name="kuma_email_form_submission_fields") |
||
14 | */ |
||
15 | View Code Duplication | class EmailFormSubmissionField extends FormSubmissionField |
|
0 ignored issues
–
show
|
|||
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 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.