<commit_before><?php
namespace Metagist;

use Symfony\Component\Validator\Constraints as Assert;

/**
 * Factory for forms.
 * 
 * @author <NAME> <<EMAIL>>
 */
class FormFactory
{
    /**
     * the categories
     * @var CategorySchema 
     */
    private $schema;
   
    /**
     * symfony form factory
     * @var Symfony\Component\Form\FormFactory 
     */
    private $formFactory;
    
    /**
     * Constructor.
     * 
     * @param \Symfony\Component\Form\FormFactory $factory
     * @param \Metagist\CategorySchema           $schema
     */
    public function __construct(\Symfony\Component\Form\FormFactory $factory, CategorySchema $schema)
    {
        $this->formFactory = $factory;
        $this->schema      = $schema;
    }
    
    /**
     * Returns the rating form.
     * 
     * @return \Symfony\Component\Form\Form
     */
    public function getRateForm(array $versions = array(''))
    {
        $builder = $this->formFactory->createBuilder('form');

        $form = $builder
            ->add('rating', 'choice', array(
                'choices' => range(1, 5),
                'constraints' => new Assert\Range(array('min' => 1, 'max' => 5)),
            ))
            ->add('version', 'choice', array(
                'choices' => array('') + $versions,
                'multiple' => false,
                'expanded' => false
            ))
            ->add('comment', 'textarea')
            ->getForm()
        ;
        
        return $form;
    }
    
    /**
     * Returns the form for metainfo contribution.
     * 
     * @param array $versions
     * @return \Symfony\Component\Form\Form
     */
    public function getContributeForm(array $versions = array(''))
    {
        $builder = $this->formFactory->createBuilder('form');
        $form = $builder
            ->add('value', 'text', array(
                'constraints' => new Assert\NotBlank(),
            ))
            ->add('version', 'choice', array(
                'choices' => array('') + $versions,
                'multiple' => false,
                'expanded' => false
            ))
            ->getForm()
        ;
        
        return $form;
    }
}<commit_msg>changed field order in contribute form<commit_after><?php
namespace Metagist;

use Symfony\Component\Validator\Constraints as Assert;

/**
 * Factory for forms.
 * 
 * @author <NAME> <<EMAIL>>
 */
class FormFactory
{
    /**
     * the categories
     * @var CategorySchema 
     */
    private $schema;
   
    /**
     * symfony form factory
     * @var Symfony\Component\Form\FormFactory 
     */
    private $formFactory;
    
    /**
     * Constructor.
     * 
     * @param \Symfony\Component\Form\FormFactory $factory
     * @param \Metagist\CategorySchema           $schema
     */
    public function __construct(\Symfony\Component\Form\FormFactory $factory, CategorySchema $schema)
    {
        $this->formFactory = $factory;
        $this->schema      = $schema;
    }
    
    /**
     * Returns the rating form.
     * 
     * @return \Symfony\Component\Form\Form
     */
    public function getRateForm(array $versions = array(''))
    {
        $builder = $this->formFactory->createBuilder('form');

        $form = $builder
            ->add('rating', 'choice', array(
                'choices' => range(1, 5),
                'constraints' => new Assert\Range(array('min' => 1, 'max' => 5)),
            ))
            ->add('version', 'choice', array(
                'choices' => array('') + $versions,
                'multiple' => false,
                'expanded' => false
            ))
            ->add('comment', 'textarea')
            ->getForm()
        ;
        
        return $form;
    }
    
    /**
     * Returns the form for metainfo contribution.
     * 
     * @param array  $versions
     * @param string $type
     * @return \Symfony\Component\Form\Form
     */
    public function getContributeForm(array $versions = array(''), $type = 'string')
    {
        $types = array(
            'url' => 'text',
            'integer' => 'number'
        );
        if (isset($types[$type])) {
            $fieldType = $types[$type];
        } else {
            $fieldType = 'text';
        }
        
        $builder = $this->formFactory->createBuilder('form');
        $form = $builder
            ->add('version', 'choice', array(
                'choices' => array('') + $versions,
                'multiple' => false,
                'expanded' => false
            ))
            ->add('value', $fieldType, array(
                'constraints' => new Assert\NotBlank(),
            ))
            ->getForm()
        ;
        
        return $form;
    }
}
{'fraction_non_alphanumeric': 0.14746052069995733, 'fraction_numerical': 0.0017072129748186087, 'mean_word_length': 1.605336297943302, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 59, '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': '6618601', 'n_tokens_mistral': 1341, 'n_tokens_neox': 1305, 'n_words': 275}