<commit_before><?php
declare (strict_types = 1);
namespace App\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;

/**
 * ContactController.
 */
class PrivacyController extends AbstractController
{
	const COOKIE = 'accept_dsgvo';

	/**
	 * @Route("/privacy", name="privacy")
	 *
	 * @return Response
	 */
	public function index(): Response {
		$hasAccepted = isset($_COOKIE[self::COOKIE]);
		$form        = $this->getForm()->createView();

		return $this->render('privacy/index.html.twig', [
			'hasAccepted' => $hasAccepted,
			'form'        => $form
		]);
	}

	/**
	 * @Route("/privacy/accept", name="privacy_accept")
	 *
	 * @param Request $request
	 * @return Response
	 */
	public function accept(Request $request): Response {
		$form = $this->getForm();

		$form->handleRequest($request);
		if ($form->isSubmitted() && $form->isValid()) {
			setcookie(self::COOKIE, '1', time() + 365 * 24 * 60 * 60, '/');
			return $this->redirectToRoute('news');
		}

		return $this->render('privacy/index.html.twig', [
			'hasAccepted' => false,
			'form'        => $form->createView()
		]);
	}

	/**
	 * @return FormInterface
	 */
	private function getForm(): FormInterface {
		$form = $this->createFormBuilder()->setAction($this->generateUrl('privacy_accept'));
		$form->add('isAccepted', CheckboxType::class);
		$form->add('accept', SubmitType::class);
		return $form->getForm();
	}
}<commit_msg>[FEATURE] #18 – Migration zu Symfony: Zustimmung übersetzt.<commit_after><?php
declare (strict_types = 1);
namespace App\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;

/**
 * ContactController.
 */
class PrivacyController extends AbstractController
{
	const COOKIE = 'accept_dsgvo';

	/**
	 * @Route("/privacy", name="privacy")
	 *
	 * @return Response
	 */
	public function index(): Response {
		$hasAccepted = isset($_COOKIE[self::COOKIE]);
		$form        = $this->getForm()->createView();

		return $this->render('privacy/index.html.twig', [
			'hasAccepted' => $hasAccepted,
			'form'        => $form
		]);
	}

	/**
	 * @Route("/privacy/accept", name="privacy_accept")
	 *
	 * @param Request $request
	 * @return Response
	 */
	public function accept(Request $request): Response {
		$form = $this->getForm();

		$form->handleRequest($request);
		if ($form->isSubmitted() && $form->isValid()) {
			setcookie(self::COOKIE, '1', time() + 365 * 24 * 60 * 60, '/');
			return $this->redirectToRoute('news');
		}

		return $this->render('privacy/index.html.twig', [
			'hasAccepted' => false,
			'form'        => $form->createView()
		]);
	}

	/**
	 * @return FormInterface
	 */
	private function getForm(): FormInterface {
		$form = $this->createFormBuilder()->setAction($this->generateUrl('privacy_accept'));
		$form->add('isAccepted', CheckboxType::class, [
			'label' => 'Ich möchte an Fantasya teilnehmen und akzeptiere diese Bedingungen.'
		]);
		$form->add('accept', SubmitType::class, ['label' => 'Zustimmen']);
		return $form->getForm();
	}
}
{'fraction_non_alphanumeric': 0.17604657610202384, 'fraction_numerical': 0.006653728860548933, 'mean_word_length': 4.491628614916286, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 45, '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': '804798', 'n_tokens_mistral': 1254, 'n_tokens_neox': 1147, 'n_words': 205}