<commit_before><?php

/**
 * This file is part of the Elcodi package.
 *
 * Copyright (c) 2014 Elcodi.com
 *
 * This distribution is just a basic e-commerce implementation based on
 * Elcodi project.
 *
 * Feel free to edit it, and make your own
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 * @author ##author_placeholder
 * @version ##version_placeholder##
 */

namespace Store\StoreUserBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Validator\Constraints\True;

/**
 * Class RegisterType
 */
class RegisterType extends AbstractType
{
    /**
     * @var UrlGeneratorInterface
     *
     * Router
     */
    protected $router;

    /**
     * @var string
     *
     * Customer namespace
     */
    protected $customerNamespace;

    /**
     * Constructor
     *
     * @param UrlGeneratorInterface $router            Router
     * @param string                $customerNamespace Customer names
     */
    public function __construct(
        UrlGeneratorInterface $router,
        $customerNamespace
    )
    {
        $this->router = $router;
        $this->customerNamespace = $customerNamespace;
    }

    /**
     * Default form options
     *
     * @param OptionsResolverInterface $resolver
     *
     * @return array With the options
     */
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => $this->customerNamespace,
        ));
    }

    /**
     * Buildform function
     *
     * @param FormBuilderInterface $builder the formBuilder
     * @param array                $options the options for this form
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->setAction(
                $this
                    ->router
                    ->generate('store_register')
            )
            ->setMethod('POST')
            ->add('firstname', 'text', array(
                'required' => true,
                'label' => 'Firstname',
            ))
            ->add('lastname', 'text', array(
                'required' => true,
                'label' => 'Lastname',
            ))
            ->add('username', 'email', array(
                'required' => true,
                'label' =>  'Username'
            ))
            ->add('email', 'email', array(
                'required' => true,
                'label' =>  'Email'
            ))
            ->add('password', 'repeated', array(
                'type' =>   'password',
                'first_options'  => array(
                    'label' => 'Password',
                ),
                'second_options' => array(
                    'label' => 'Repeat Password',<commit_msg>Register form type username field should be text<commit_after><?php

/**
 * This file is part of the Elcodi package.
 *
 * Copyright (c) 2014 Elcodi.com
 *
 * This distribution is just a basic e-commerce implementation based on
 * Elcodi project.
 *
 * Feel free to edit it, and make your own
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 * @author ##author_placeholder
 * @version ##version_placeholder##
 */

namespace Store\StoreUserBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Validator\Constraints\True;

/**
 * Class RegisterType
 */
class RegisterType extends AbstractType
{
    /**
     * @var UrlGeneratorInterface
     *
     * Router
     */
    protected $router;

    /**
     * @var string
     *
     * Customer namespace
     */
    protected $customerNamespace;

    /**
     * Constructor
     *
     * @param UrlGeneratorInterface $router            Router
     * @param string                $customerNamespace Customer names
     */
    public function __construct(
        UrlGeneratorInterface $router,
        $customerNamespace
    )
    {
        $this->router = $router;
        $this->customerNamespace = $customerNamespace;
    }

    /**
     * Default form options
     *
     * @param OptionsResolverInterface $resolver
     *
     * @return array With the options
     */
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => $this->customerNamespace,
        ));
    }

    /**
     * Buildform function
     *
     * @param FormBuilderInterface $builder the formBuilder
     * @param array                $options the options for this form
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->setAction(
                $this
                    ->router
                    ->generate('store_register')
            )
            ->setMethod('POST')
            ->add('firstname', 'text', array(
                'required' => true,
                'label' => 'Firstname',
            ))
            ->add('lastname', 'text', array(
                'required' => true,
                'label' => 'Lastname',
            ))
            ->add('username', 'text', array(
                'required' => true,
                'label' =>  'Username'
            ))
            ->add('email', 'email', array(
                'required' => true,
                'label' =>  'Email'
            ))
            ->add('password', 'repeated', array(
                'type' =>   'password',
                'first_options'  => array(
                    'label' => 'Password',
                ),
                'second_options' => array(
                    'label' => 'Repeat Password',
{'fraction_non_alphanumeric': 0.1107470511140236, 'fraction_numerical': 0.001310615989515072, 'mean_word_length': 1.8263888888888888, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 57, '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': '2490530', 'n_tokens_mistral': 1584, 'n_tokens_neox': 1527, 'n_words': 392}