<commit_before><?php

namespace Ruvents\FrujaxBundle\EventListener;

use Ruvents\FrujaxBundle\HttpFoundation\FrujaxRedirectResponse;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
use Symfony\Component\HttpKernel\KernelEvents;

class FrujaxSubscriber implements EventSubscriberInterface
{
    /**
     * {@inheritdoc}
     */
    public static function getSubscribedEvents()
    {
        return [
            KernelEvents::RESPONSE => [
                ['processRedirectResponse', 1],
                ['processResponse', 0],
            ],
        ];
    }

    /**
     * @param FilterResponseEvent $event
     */
    public function processRedirectResponse(FilterResponseEvent $event)
    {
        $request = $event->getRequest();
        $response = $event->getResponse();

        if ($response instanceof RedirectResponse
            && $this->isFrujaxRequest($request)
            && $request->headers->has('Frujax-Intercept-Redirect')
        ) {
            $frujaxResponse = new FrujaxRedirectResponse($response->getTargetUrl(), $response->headers);
            $frujaxResponse->setProtocolVersion($response->getProtocolVersion());
            $frujaxResponse->setCharset($response->getCharset());

            $event->setResponse($frujaxResponse);
        }
    }

    /**
     * @param FilterResponseEvent $event
     */
    public function processResponse(FilterResponseEvent $event)
    {<commit_msg>Response / Fixed headers array type<commit_after><?php

namespace Ruvents\FrujaxBundle\EventListener;

use Ruvents\FrujaxBundle\HttpFoundation\FrujaxRedirectResponse;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
use Symfony\Component\HttpKernel\KernelEvents;

class FrujaxSubscriber implements EventSubscriberInterface
{
    /**
     * {@inheritdoc}
     */
    public static function getSubscribedEvents()
    {
        return [
            KernelEvents::RESPONSE => [
                ['processRedirectResponse', 1],
                ['processResponse', 0],
            ],
        ];
    }

    /**
     * @param FilterResponseEvent $event
     */
    public function processRedirectResponse(FilterResponseEvent $event)
    {
        $request = $event->getRequest();
        $response = $event->getResponse();

        if ($response instanceof RedirectResponse
            && $this->isFrujaxRequest($request)
            && $request->headers->has('Frujax-Intercept-Redirect')
        ) {
            $frujaxResponse = new FrujaxRedirectResponse($response->getTargetUrl(), $response->headers->all());
            $frujaxResponse->setProtocolVersion($response->getProtocolVersion());
            $frujaxResponse->setCharset($response->getCharset());

            $event->setResponse($frujaxResponse);
        }
    }

    /**
     * @param FilterResponseEvent $event
     */
    public function processResponse(FilterResponseEvent $event)
    {
{'fraction_non_alphanumeric': 0.11290824261275272, 'fraction_numerical': 0.001244167962674961, 'mean_word_length': 3.040201005025126, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 30, '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': '5544111', 'n_tokens_mistral': 847, 'n_tokens_neox': 827, 'n_words': 126}