Completed
Push — master ( 1de9b7...830752 )
by Kristof
38:46 queued 24:09
created

FormBundle/Form/StringFormSubmissionType.php (1 issue)

Upgrade to new PHP Analysis Engine

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\Form;
4
5
use Symfony\Component\Form\AbstractType;
6
use Symfony\Component\Form\Extension\Core\Type\TextType;
7
use Symfony\Component\Form\FormBuilderInterface;
8
use Symfony\Component\OptionsResolver\OptionsResolver;
9
10
/**
11
 * The type for the StringFormSubmissionField
12
 */
13 View Code Duplication
class StringFormSubmissionType extends AbstractType
0 ignored issues
show
This class seems to be duplicated in your project.

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.

Loading history...
14
{
15
    /**
16
     * @param FormBuilderInterface $builder The form builder
17
     * @param array                $options The options
18
     */
19
    public function buildForm(FormBuilderInterface $builder, array $options)
20
    {
21
        $keys = array_fill_keys(array('label', 'required', 'constraints'), null);
22
        $fieldOptions = array_filter(array_replace($keys, array_intersect_key($options, $keys)), function ($v) {
23
            return isset($v);
24
        });
25
        $builder->add('value', TextType::class, $fieldOptions);
26
    }
27
28
    public function configureOptions(OptionsResolver $resolver)
29
    {
30
        $resolver->setDefaults(array(
31
            'data_class' => 'Kunstmaan\FormBundle\Entity\FormSubmissionFieldTypes\StringFormSubmissionField',
32
        ));
33
    }
34
35
    /**
36
     * @return string
37
     */
38
    public function getBlockPrefix()
39
    {
40
        return 'kunstmaan_formbundle_stringformsubmissiontype';
41
    }
42
}
43