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\TextFormSubmissionType; |
||
8 | |||
9 | /** |
||
10 | * The TextFormSubmissionField can be used to store multi-line string values to a FormSubmission |
||
11 | * |
||
12 | * @ORM\Entity |
||
13 | * @ORM\Table(name="kuma_text_form_submission_fields") |
||
14 | */ |
||
15 | View Code Duplication | class TextFormSubmissionField extends FormSubmissionField |
|
0 ignored issues
–
show
|
|||
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 |
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.