<commit_before><?php

namespace Event\EventBundle\Controller;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Event\EventBundle\Entity\CallForPaper;
use Event\EventBundle\Form\Type\ContactType;
use Event\EventBundle\Form\Type\CallForPaperType;

class EventController extends Controller
{
    public function indexAction()
    {
        return $this->render('EventEventBundle:Event:index.html.twig', []);
    }

    public function carouselAction()
    {
        return $this->render('EventEventBundle:Component:_carousel.html.twig', [
            'event' => $this->getEvent()
        ]);
    }

    public function speakersAction()
    {
        $form = $this->callForPaper();

        return $this->render('EventEventBundle:Component:_speakers.html.twig', [
            'currentEvent' => $this->getEvent(),
            'speakers' => $this->getEvent()->getSpeakers(),
            'form' => $form->createView(),
            'captcha' => $this->getCaptcha()
        ]);
    }

    public function venueAction()
    {
        return $this->render('EventEventBundle:Component:_venue.html.twig', [
            'event' => $this->getEvent()
        ]);
    }

    public function scheduleAction(Request $request)
    {
        $host = $request->getHttpHost();

        return $this->render('EventEventBundle:Component:_schedule.html.twig', [
            'schedule' => $this->getRepository('EventEventBundle:Event')->getProgram($host)
        ]);
    }

    public function sponsorsAction()
    {
        return $this->render('EventEventBundle:Component:_sponsors.html.twig', [
            'event' => $this->getEvent()
        ]);
    }

    public function organizersAction()
    {
        return $this->render('EventEventBundle:Component:_organizers.html.twig', [
            'event' => $this->getEvent()
        ]);
    }

    public function contactAction(Request $request)
    {
        $event = $this->getEvent();

        $form = $this->createForm(ContactType::class);
        if ($request->isMethod('POST') && $form->handleRequest($request)) {
            if ($form->isValid() && $request->getSession()->get('captchaResult') == $request->request->get('calc')) {
                $this->get('eventator_mailer')->send(
                    $event->getEmail(),
                    'Contact Request - '.$event->getTitle(),
                    sprintf(
                        'Hello!<br /><br />Contact request: %s <br />',
                        nl2br($form->get('message')->getData())
                    ),
                    $form->get('email')->getData()
                );

                $this->setSuccessFlash('Thank you for request, we\'ll answer back asap.');

                return $this->redirectToRoute('event_homepage');
            }
        }

        return $this->render('EventEventBundle:Component:_contact.html.twig', [
            'event' => $event,
            'form' => $form->createView(),
            'captcha' => $this->getCaptcha()
        ]);
    }

    public function callForPaperAction(Request $request)
    {
        $entity = new CallForPaper();
        $event = $this->getEvent();
        $entity->setEvent($event);

        $form = $this->callForPaper($entity);
        $form->handleRequest($request);

        if ($form->isValid() && $request->getSession()->get('captchaResult') == $request->request->get('calc')) {
            $this->getManager()->persist($entity);
            $this->getManager()->flush();

            $this->get('eventator_mailer')->send(
                $event->getEmail(),
                'Call For Paper Request - '.$event->getTitle(),
                $this->renderView('EventEventBundle:Email:_callForPaper.html.twig', [
                    'data' => $request->request->get($form->getName()),
                    'from' => $form->get('email')->getData(),
                    'languages' => $this->container->getParameter('event.speech_languages'),
                    'levels' => $this->container->getParameter('event.speech_levels'),
                ]),
                $form->get('email')->getData()
            );

                return new Response('Success');

        }

        return new Response($this->renderView('EventEventBundle:Event:_form.html.twig', [
            'form' => $form->createView(),
            'captcha' => $this->getCaptcha()
        ]));
    }

    public function callForPaperViewAction()
    {
        $entity = new CallForPaper();
        $entity->setEvent($this->getEvent());
        $form = $this->callForPaper($entity);

        return new Response($this->renderView('EventEventBundle:Event:callForPaperView.html.twig', [
            'form' => $form->createView(),
            'captcha' => $this->getCaptcha()
        ]));
    }

    protected function callForPaper(CallForPaper $entity = null)
    {
        return $this->createForm(CallForPaperType::class, $entity);
    }
}
<commit_msg>delete "tab" in line 122<commit_after><?php

namespace Event\EventBundle\Controller;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Event\EventBundle\Entity\CallForPaper;
use Event\EventBundle\Form\Type\ContactType;
use Event\EventBundle\Form\Type\CallForPaperType;

class EventController extends Controller
{
    public function indexAction()
    {
        return $this->render('EventEventBundle:Event:index.html.twig', []);
    }

    public function carouselAction()
    {
        return $this->render('EventEventBundle:Component:_carousel.html.twig', [
            'event' => $this->getEvent()
        ]);
    }

    public function speakersAction()
    {
        $form = $this->callForPaper();

        return $this->render('EventEventBundle:Component:_speakers.html.twig', [
            'currentEvent' => $this->getEvent(),
            'speakers' => $this->getEvent()->getSpeakers(),
            'form' => $form->createView(),
            'captcha' => $this->getCaptcha()
        ]);
    }

    public function venueAction()
    {
        return $this->render('EventEventBundle:Component:_venue.html.twig', [
            'event' => $this->getEvent()
        ]);
    }

    public function scheduleAction(Request $request)
    {
        $host = $request->getHttpHost();

        return $this->render('EventEventBundle:Component:_schedule.html.twig', [
            'schedule' => $this->getRepository('EventEventBundle:Event')->getProgram($host)
        ]);
    }

    public function sponsorsAction()
    {
        return $this->render('EventEventBundle:Component:_sponsors.html.twig', [
            'event' => $this->getEvent()
        ]);
    }

    public function organizersAction()
    {
        return $this->render('EventEventBundle:Component:_organizers.html.twig', [
            'event' => $this->getEvent()
        ]);
    }

    public function contactAction(Request $request)
    {
        $event = $this->getEvent();

        $form = $this->createForm(ContactType::class);
        if ($request->isMethod('POST') && $form->handleRequest($request)) {
            if ($form->isValid() && $request->getSession()->get('captchaResult') == $request->request->get('calc')) {
                $this->get('eventator_mailer')->send(
                    $event->getEmail(),
                    'Contact Request - '.$event->getTitle(),
                    sprintf(
                        'Hello!<br /><br />Contact request: %s <br />',
                        nl2br($form->get('message')->getData())
                    ),
                    $form->get('email')->getData()
                );

                $this->setSuccessFlash('Thank you for request, we\'ll answer back asap.');

                return $this->redirectToRoute('event_homepage');
            }
        }

        return $this->render('EventEventBundle:Component:_contact.html.twig', [
            'event' => $event,
            'form' => $form->createView(),
            'captcha' => $this->getCaptcha()
        ]);
    }

    public function callForPaperAction(Request $request)
    {
        $entity = new CallForPaper();
        $event = $this->getEvent();
        $entity->setEvent($event);

        $form = $this->callForPaper($entity);
        $form->handleRequest($request);

        if ($form->isValid() && $request->getSession()->get('captchaResult') == $request->request->get('calc')) {
            $this->getManager()->persist($entity);
            $this->getManager()->flush();

            $this->get('eventator_mailer')->send(
                $event->getEmail(),
                'Call For Paper Request - '.$event->getTitle(),
                $this->renderView('EventEventBundle:Email:_callForPaper.html.twig', [
                    'data' => $request->request->get($form->getName()),
                    'from' => $form->get('email')->getData(),
                    'languages' => $this->container->getParameter('event.speech_languages'),
                    'levels' => $this->container->getParameter('event.speech_levels'),
                ]),
                $form->get('email')->getData()
            );

            return new Response('Success');

        }

        return new Response($this->renderView('EventEventBundle:Event:_form.html.twig', [
            'form' => $form->createView(),
            'captcha' => $this->getCaptcha()
        ]));
    }

    public function callForPaperViewAction()
    {
        $entity = new CallForPaper();
        $entity->setEvent($this->getEvent());
        $form = $this->callForPaper($entity);

        return new Response($this->renderView('EventEventBundle:Event:callForPaperView.html.twig', [
            'form' => $form->createView(),
            'captcha' => $this->getCaptcha()
        ]));
    }

    protected function callForPaper(CallForPaper $entity = null)
    {
        return $this->createForm(CallForPaperType::class, $entity);
    }
}

{'fraction_non_alphanumeric': 0.16563733927305863, 'fraction_numerical': 0.0005062265870203503, 'mean_word_length': 2.258990432200594, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 211, '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': '1081499', 'n_tokens_mistral': 2783, 'n_tokens_neox': 2648, 'n_words': 388}