<commit_before><?php

namespace Bundle\MainBundle\Controller;

use Bundle\CommonBundle\Controller\BaseController;
use Bundle\CommonBundle\Entity\Calendar\CalendarRepository;
use Bundle\CommonBundle\Response\JsonResponse;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Symfony\Component\HttpFoundation\Request;

/**
 * @Route("/api")
 */
class ApiController extends BaseController
{
    /**
     * @Route("/getCalendarEvents")
     * @Method("GET")
     */
    public function getCalendarEventsAction(Request $request)
    {
	    $response = new JsonResponse();

	    $startDate = (int) $request->get('startDate');
	    $endDate = (int) $request->get('endDate');

	    try {
		    /** @var CalendarRepository $calendarRepository */
		    $calendarRepository = $this->getRepository('calendar');

		    $data = $calendarRepository->getCalendarEventsJson($startDate, $endDate);

	    } catch (\Exception $ex) {
		    return $this->generateError('repository.get', $ex);
	    }


	    $response->setJsonContent(array(
		    "data" => $data
	    ));
      $response->headers->set('Content-type', 'application/json');
      $response->headers->set("Access-Control-Allow-Origin", "*");
      $response->headers->set("Access-Control-Allow-Methods", "GET, POST, OPTIONS");
      $response->headers->set('Access-Control-Expose-Headers', 'ETag, Link, X-RateLimit-Limit,
       X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval');
      $response->headers->set('Access-Control-Allow-Credentials', 'true');
      $response->headers->set('Content-Security-Policy', "default-src 'none'");
      $response->headers->set('Vary', "Accept-Encoding");
      $response->headers->set('X-Content-Type-Options', "nosniff");
      $response->headers->set('X-Frame-Options', "deny");
      $response->headers->set('X-XSS-Protection', "1; mode=block");<commit_msg>fix header<commit_after><?php

namespace Bundle\MainBundle\Controller;

use Bundle\CommonBundle\Controller\BaseController;
use Bundle\CommonBundle\Entity\Calendar\CalendarRepository;
use Bundle\CommonBundle\Response\JsonResponse;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Symfony\Component\HttpFoundation\Request;

/**
 * @Route("/api")
 */
class ApiController extends BaseController
{
    /**
     * @Route("/getCalendarEvents")
     * @Method("GET")
     */
    public function getCalendarEventsAction(Request $request)
    {
	    $response = new JsonResponse();

	    $startDate = (int) $request->get('startDate');
	    $endDate = (int) $request->get('endDate');

	    try {
		    /** @var CalendarRepository $calendarRepository */
		    $calendarRepository = $this->getRepository('calendar');

		    $data = $calendarRepository->getCalendarEventsJson($startDate, $endDate);

	    } catch (\Exception $ex) {
		    return $this->generateError('repository.get', $ex);
	    }


	    $response->setJsonContent(array(
		    "data" => $data
	    ));
      $response->headers->set('Content-type', 'application/json');
      $response->headers->set("Access-Control-Allow-Origin", "*");
      $response->headers->set("Access-Control-Allow-Methods", "GET, POST, OPTIONS");
      $response->headers->set('Access-Control-Expose-Headers', 'ETag, Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval');
      $response->headers->set('Access-Control-Allow-Credentials', 'true');
      $response->headers->set('Content-Security-Policy', "default-src 'none'");
      $response->headers->set('Vary', "Accept-Encoding");
      $response->headers->set('X-Content-Type-Options', "nosniff");
      $response->headers->set('X-Frame-Options', "deny");
      $response->headers->set('X-XSS-Protection', "1; mode=block");
{'fraction_non_alphanumeric': 0.171712158808933, 'fraction_numerical': 0.0004962779156327543, 'mean_word_length': 4.296977660972405, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 57, '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': '820429', 'n_tokens_mistral': 1226, 'n_tokens_neox': 1171, 'n_words': 170}