Code Duplication    Length = 42-42 lines in 2 locations

src/Kunstmaan/LeadGenerationBundle/Form/Rule/LocaleBlackListAdminType.php 1 location

@@ 9-50 (lines=42) @@
6
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
7
use Symfony\Component\Form\FormBuilderInterface;
8
9
class LocaleBlackListAdminType extends AbstractRuleAdminType
10
{
11
    private $locales;
12
13
    public function __construct(DomainConfigurationInterface $domainConfiguration)
14
    {
15
        $locales = $domainConfiguration->getFrontendLocales();
16
        $this->locales = array_combine($locales, $locales);
17
    }
18
19
    /**
20
     * Builds the form.
21
     *
22
     * This method is called for each type in the hierarchy starting form the
23
     * top most type. Type extensions can further modify the form.
24
     *
25
     * @see FormTypeExtensionInterface::buildForm()
26
     *
27
     * @param FormBuilderInterface $builder The form builder
28
     * @param array                $options The options
29
     */
30
    public function buildForm(FormBuilderInterface $builder, array $options)
31
    {
32
        $builder->add('locale', ChoiceType::class, array(
33
            'label' => 'kuma_lead_generation.form.locale_black_list.locale.label',
34
            'attr' => array(
35
                'info_text' => 'kuma_lead_generation.form.locale_black_list.locale.info_text',
36
            ),
37
            'choices' => $this->locales,
38
        ));
39
    }
40
41
    /**
42
     * Returns the name of this type.
43
     *
44
     * @return string The name of this type
45
     */
46
    public function getBlockPrefix()
47
    {
48
        return 'locale_blacklist_form';
49
    }
50
}
51

src/Kunstmaan/LeadGenerationBundle/Form/Rule/LocaleWhiteListAdminType.php 1 location

@@ 9-50 (lines=42) @@
6
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
7
use Symfony\Component\Form\FormBuilderInterface;
8
9
class LocaleWhiteListAdminType extends AbstractRuleAdminType
10
{
11
    private $locales;
12
13
    public function __construct(DomainConfigurationInterface $domainConfiguration)
14
    {
15
        $locales = $domainConfiguration->getFrontendLocales();
16
        $this->locales = array_combine($locales, $locales);
17
    }
18
19
    /**
20
     * Builds the form.
21
     *
22
     * This method is called for each type in the hierarchy starting form the
23
     * top most type. Type extensions can further modify the form.
24
     *
25
     * @see FormTypeExtensionInterface::buildForm()
26
     *
27
     * @param FormBuilderInterface $builder The form builder
28
     * @param array                $options The options
29
     */
30
    public function buildForm(FormBuilderInterface $builder, array $options)
31
    {
32
        $builder->add('locale', ChoiceType::class, array(
33
            'label' => 'kuma_lead_generation.form.locale_white_list.locale.label',
34
            'attr' => array(
35
                'info_text' => 'kuma_lead_generation.form.locale_white_list.locale.info_text',
36
            ),
37
            'choices' => $this->locales,
38
        ));
39
    }
40
41
    /**
42
     * Returns the name of this type.
43
     *
44
     * @return string The name of this type
45
     */
46
    public function getBlockPrefix()
47
    {
48
        return 'locale_whitelist_form';
49
    }
50
}
51