<commit_before><?php

/*
 * This file is part of `Composer as a service`.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Ayaline\Bundle\ComposerBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;

use Ayaline\Bundle\ComposerBundle\Validator\Constraints\ComposerJson;

class ComposerType extends AbstractType
{
    /**
     * @var string
     */
    private $defaultComposerBody = <<<DCB
{
    "require": {
        "monolog/monolog": "1.2.*"
    }
}
DCB;

    /**
     * {@inheritDoc}
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add(
                'body',
                'textarea',
                array(
                    'attr' => array(
                        'class' => 'form-control',
                        'rows' => 15,
                    ),
                    'data' => $this->defaultComposerBody,
                    'constraints' => array(
                        new ComposerJson()<commit_msg>prevent browser to check spellcheck in textarea<commit_after><?php

/*
 * This file is part of `Composer as a service`.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Ayaline\Bundle\ComposerBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;

use Ayaline\Bundle\ComposerBundle\Validator\Constraints\ComposerJson;

class ComposerType extends AbstractType
{
    /**
     * @var string
     */
    private $defaultComposerBody = <<<DCB
{
    "require": {
        "monolog/monolog": "1.2.*"
    }
}
DCB;

    /**
     * {@inheritDoc}
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add(
                'body',
                'textarea',
                array(
                    'attr' => array(
                        'class' => 'form-control',
                        'rows' => 15,
                        'spellcheck'=> false
                    ),
                    'data' => $this->defaultComposerBody,
                    'constraints' => array(
                        new ComposerJson()
{'fraction_non_alphanumeric': 0.11511387163561076, 'fraction_numerical': 0.0033126293995859213, 'mean_word_length': 1.7674684994272623, 'pattern_counts': {'":': 4, '<': 17, '<?xml version=': 0, '>': 24, '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': '932764', 'n_tokens_mistral': 675, 'n_tokens_neox': 646, 'n_words': 161}