<commit_before><?php

namespace Pum\Bundle\AppBundle\Form\Type;

use Pum\Bundle\AppBundle\Entity\Group;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface;
use Symfony\Component\Validator\Constraints\Length;
use Symfony\Component\Validator\Constraints\NotBlank;

class GroupType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $permissions = Group::getKnownPermissions();
        $groupDefinition = $builder->getData();

        if (null !== $groupDefinition) {
            $builder
                ->add('alias', 'text', array('data' => $groupDefinition->getAliasName()))
                ->add('name', 'text', array('data' => $groupDefinition->getName(), 'disabled' => true));
        } else {
            $builder
                ->add('alias', 'text', array(
                    'attr' => array(
                        'data-text-prefix' => 'group_',
                        'data-copy-input'  => '#pum_group_name',
                        'data-text-camelize' => true,
                        'class' => 'copy-input'
                    )
                ))
                ->add('name', 'text', array(
                    'data' => 'group_',
                    'read_only' => true,
                ));
        }

        $builder->add('admin', 'checkbox', array('required' => false))
            ->add('permissions', 'choice', array(
                'choices'  => array_combine($permissions, $permissions),
                'multiple' => true,
                'expanded' => true
            ))
            ->add('save', 'submit');
    }

    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class'        => 'Pum\Bundle\AppBundle\Entity\Group',
            'translation_domain' => 'pum_form'
        ));
    }

    public function getName()
    {
        return 'pum_group';
    }
}
<commit_msg>Groups<commit_after><?php

namespace Pum\Bundle\AppBundle\Form\Type;

use Pum\Bundle\AppBundle\Entity\Group;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface;
use Symfony\Component\Validator\Constraints\Length;
use Symfony\Component\Validator\Constraints\NotBlank;

class GroupType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $permissions = Group::getKnownPermissions();
        $groupDefinition = $builder->getData();

        if (null !== $groupDefinition) {
            $builder
                ->add('alias', 'text', array('data' => $groupDefinition->getAliasName()))
                ->add('name', 'text', array('data' => $groupDefinition->getName(), 'disabled' => true));
        } else {
            $builder
                ->add('alias', 'text', array(
                    'attr' => array(
                        'data-text-prefix' => 'group_',
                        'data-copy-input'  => '#pum_group_name',
                        'data-text-camelize' => true,
                        'class' => 'copy-input'
                    )
                ))
                ->add('name', 'text', array(
                    'data' => 'group_',
                    'read_only' => true,
                ));
        }

        $builder->add('permissions', 'choice', array(
                'choices'  => array_combine($permissions, $permissions),
                'multiple' => true,
                'expanded' => true
            ))
            ->add('save', 'submit');
    }

    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class'        => 'Pum\Bundle\AppBundle\Entity\Group',
            'translation_domain' => 'pum_form'
        ));
    }

    public function getName()
    {
        return 'pum_group';
    }
}

{'fraction_non_alphanumeric': 0.13789912077741787, 'fraction_numerical': 0.0, 'mean_word_length': 2.0251924422673198, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 55, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1684541', 'n_tokens_mistral': 1180, 'n_tokens_neox': 1145, 'n_words': 198}