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\LeadGenerationBundle\Entity\Rule; |
||
4 | |||
5 | use Doctrine\ORM\Mapping as ORM; |
||
6 | use Kunstmaan\LeadGenerationBundle\Form\Rule\LocaleWhiteListAdminType; |
||
7 | use Symfony\Component\Validator\Constraints as Assert; |
||
8 | |||
9 | /** |
||
10 | * @ORM\Entity |
||
11 | * @ORM\Table(name="kuma_rule_locale_whitelist") |
||
12 | */ |
||
13 | View Code Duplication | class LocaleWhitelistRule extends AbstractRule |
|
0 ignored issues
–
show
|
|||
14 | { |
||
15 | /** |
||
16 | * @var string |
||
17 | * @ORM\Column(name="locale", type="text", nullable=true) |
||
18 | * @Assert\NotBlank() |
||
19 | */ |
||
20 | private $locale; |
||
21 | |||
22 | /** |
||
23 | * @return string |
||
24 | */ |
||
25 | public function getLocale() |
||
26 | { |
||
27 | return $this->locale; |
||
28 | } |
||
29 | |||
30 | /** |
||
31 | * @param string $locale |
||
32 | * |
||
33 | * @return LocaleWhitelistRule |
||
34 | */ |
||
35 | public function setLocale($locale) |
||
36 | { |
||
37 | $this->locale = $locale; |
||
38 | |||
39 | return $this; |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * {@inheritdoc} |
||
44 | */ |
||
45 | public function getJsObjectClass() |
||
46 | { |
||
47 | return 'LocaleWhitelistRule'; |
||
48 | } |
||
49 | |||
50 | /** |
||
51 | * {@inheritdoc} |
||
52 | */ |
||
53 | public function getJsProperties() |
||
54 | { |
||
55 | return array( |
||
56 | 'locale' => $this->getLocale(), |
||
57 | ); |
||
58 | } |
||
59 | |||
60 | /** |
||
61 | * @return string |
||
62 | */ |
||
63 | public function getService() |
||
64 | { |
||
65 | return 'kunstmaan_lead_generation.rule.service.localeruleservice'; |
||
66 | } |
||
67 | |||
68 | /** |
||
69 | * {@inheritdoc} |
||
70 | */ |
||
71 | public function getJsFilePath() |
||
72 | { |
||
73 | return '/bundles/kunstmaanleadgeneration/js/rule/LocaleWhitelistRule.js'; |
||
74 | } |
||
75 | |||
76 | /** |
||
77 | * @return string |
||
78 | */ |
||
79 | public function getAdminType() |
||
80 | { |
||
81 | return LocaleWhiteListAdminType::class; |
||
82 | } |
||
83 | } |
||
84 |
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.