<commit_before><?php
/**
 * @package     Mautic
 * @copyright   2014 Mautic Contributors. All rights reserved.
 * @author      Mautic
 * @link        http://mautic.org
 * @license     GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */

namespace Mautic\LeadBundle\Form\Type;

use Mautic\CoreBundle\Factory\MauticFactory;
use Mautic\CoreBundle\Form\EventListener\CleanFormSubscriber;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Validator\Constraints\Email;
use Symfony\Component\Validator\Constraints\NotBlank;

/**
 * Class EmailType
 *
 * @package Mautic\EmailBundle\Form\Type
 */
class EmailType extends AbstractType
{

    /**
     * @var MauticFactory
     */
    private $factory;

    public function __construct(MauticFactory $factory)
    {
        $this->factory = $factory;
    }

    /**
     * @param FormBuilderInterface $builder
     * @param array                $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->addEventSubscriber(new CleanFormSubscriber(array('body' => 'html')));

        $builder->add(
            'subject',
            'text',
            array(
                'label'      => 'mautic.email.subject',
                'label_attr' => array('class' => 'control-label'),
                'attr'       => array('class' => 'form-control'),
                'required'   => false
            )
        );

        $user    = $this->factory->getUser();
        
         $default = (empty($options['data']['fromname'])) ? $user->getFirstName() . ' ' . $user->getLastName() : $options['data']['fromname'];
        $builder->add(
                'fromname', 'text', array(
            'label' => 'mautic.lead.email.from_name',
            'label_attr' => array('class' => 'control-label'),
            'attr' => array('class' => 'form-control'),
            'required' => false,
            'data' => $default
                )
        );
        
        $default = (empty($options['data']['from'])) ? $user->getEmail() : $options['data']['from'];
        $builder->add(
            'from',
            'text',
            array(
                'label'      => 'mautic.lead.email.from_email',
                'label_attr' => array('class' => 'control-label'),
                'attr'       => array('class' => 'form-control'),
                'required'   => false,
                'data'       => $default,<commit_msg>Smal update code standard<commit_after><?php
/**
 * @package     Mautic
 * @copyright   2014 Mautic Contributors. All rights reserved.
 * @author      Mautic
 * @link        http://mautic.org
 * @license     GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */

namespace Mautic\LeadBundle\Form\Type;

use Mautic\CoreBundle\Factory\MauticFactory;
use Mautic\CoreBundle\Form\EventListener\CleanFormSubscriber;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Validator\Constraints\Email;
use Symfony\Component\Validator\Constraints\NotBlank;

/**
 * Class EmailType
 *
 * @package Mautic\EmailBundle\Form\Type
 */
class EmailType extends AbstractType
{

    /**
     * @var MauticFactory
     */
    private $factory;

    public function __construct(MauticFactory $factory)
    {
        $this->factory = $factory;
    }

    /**
     * @param FormBuilderInterface $builder
     * @param array                $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->addEventSubscriber(new CleanFormSubscriber(array('body' => 'html')));

        $builder->add(
            'subject',
            'text',
            array(
                'label'      => 'mautic.email.subject',
                'label_attr' => array('class' => 'control-label'),
                'attr'       => array('class' => 'form-control'),
                'required'   => false
            )
        );

        $user    = $this->factory->getUser();
        
         $default = (empty($options['data']['fromname'])) ? $user->getFirstName() . ' ' . $user->getLastName() : $options['data']['fromname'];
        $builder->add(
            'fromname', 
            'text', 
             array(
            'label' => 'mautic.lead.email.from_name',
            'label_attr' => array('class' => 'control-label'),
            'attr' => array('class' => 'form-control'),
            'required' => false,
            'data' => $default
                )
        );
        
        $default = (empty($options['data']['from'])) ? $user->getEmail() : $options['data']['from'];
        $builder->add(
            'from',
            'text',
            array(
                'label'      => 'mautic.lead.email.from_email',
                'label_attr' => array('class' => 'control-label'),
                'attr'       => array('class' => 'form-control'),
                'required'   => false,
                'data'       => $default,
{'fraction_non_alphanumeric': 0.15725404110955898, 'fraction_numerical': 0.0027938535222510478, 'mean_word_length': 1.9994015559545182, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 65, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '125491', 'n_tokens_mistral': 1468, 'n_tokens_neox': 1426, 'n_words': 244}